<style>
    .biaoti {
        /*border-bottom: 1px solid #ccc;*/
        padding: 10px;
        box-sizing: border-box;
        background: #e3eced;
        display: flex;
        align-items: center;
        font-size: 16px;
        color: #666;margin-bottom: 20px;
    }

    .biaoti .xian {
        width: 8px;
        height: 20px;
        background: #18bc9c;
        margin-right: 10px;
    }
    .kk{
        width:49%;
        background: #fff;
    }
    body{
        background:#f2f2f2!important;
    }
    .is-dialog #main{
        background:#f2f2f2!important;
    }
    .tabs{
        background: #fff;
        margin-top: 20px;
    }
    .tabs-content{
        display: flex;
        flex-direction: column-reverse;
        padding-top: 20px;
        width: 95%;
        margin: auto;
    }
    .tabs-content > .tab {
        display: none;
    }

    .tabs-content > div.active {
        display: block;
    }
    .tabs-content .tab .left{
        width: 25%;
        float: left;
    }
    .tabs-content .tab .right{
        width: 25%;
        float: left;
    }
    .tabs-content .tab .zhong{
        width: 25%;
        float: left;
    }
    .tabs .col-sm-2{
        width: 100%;
        text-align: left;
    }
    .tab-label{
        width: 140px;
        text-align: center;
        cursor: pointer;
        height: 30px;
        line-height: 30px;
        margin: 0;
    }
    .tab-label.active{
        background: #1E9FFF;
        color: #fff;
    }
    .tab-labels{
        /*padding: 10px;*/
        box-sizing: border-box;
        background: #e3eced;
        display: flex;
        align-items: center;
        font-size: 14px;
        color: #666;
    }
    .tab-labels .xian {
        width: 8px;
        height: 20px;
        background: #18bc9c;
        margin-right: 10px;
        margin-left: 10px;
    }
    .tcxm-td td{
        background: #3683D3;
        color: #fff;
        text-align: center;
        border-right: 1px solid;
    }

    .form-inline input{
        width: 100%!important;
    }
    .form-inline td:nth-child(2) input{
        width: 12%!important;
    }
    .form-inline td{
        border-right: 1px solid #e6e6e6;
        border-bottom: 1px solid #e6e6e6;
    }
    .form-inline td:nth-child(1){
        border-left: 1px solid #e6e6e6;
    }
    .form-inline td:nth-child(2){
        text-align: center;
    }
</style>
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <div style="width:100%;background:#fff;margin-bottom:10px;padding:10px;box-sizing:border-box;display: flex;">
        <div class="input" style="position:relative; width: 500px">
            <label class="control-label col-xs-12 col-sm-2">{:__('车架号')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input type="text" placeholder="" id="sou_val"  class="form-control"/>
                <div id="quan_sou" class="ann" style="position:absolute;right: -60px;top:0;padding: 7px 10px;background: #1E9FFF;color: #fff;border-radius: 5px;cursor:pointer;">查信息</div>
            </div>
        </div>
    </div>
    <div style="display: flex;width:100%;justify-content: space-between">
        <div class="kk">
            <div class="biaoti">
                <div class="xian"></div>
                车主信息
                <div class="input1" style="margin: 0;padding: 5px;width:200px !important;text-align: right">
                    <span>同被服务人</span><input type="checkbox" id="cbrcz" />
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('车主姓名')}<span style="color:red">*</span>:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-car_owner" class="form-control" name="row[car_owner]" type="text" value="" data-rule="required">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('证件类型')}<span style="color:red">*</span>:</label>
                <div class="col-xs-12 col-sm-8">
                    <select name="row[car_card_kind]" id="c-car_card_kind" class="form-control">
                        <option value="0">身份证</option>
                        <option value="1">统一社会信用代码</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('证件号')}<span style="color:red">*</span>:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-car_card" class="form-control" name="row[car_card]" type="text" value="" data-rule="required">
                </div>
            </div>


        </div>
        <div class="kk">
            <div class="biaoti">
                <div class="xian"></div>
                被服务人（付款人）
                <div class="input1" style="margin: 0;padding: 5px;width:100px !important;text-align: right">
                    <span>同车主</span><input type="checkbox" id="tcz" />
                </div>
                <div class="input-group"><input name="file" id="file" type="hidden" class="form-control" value="" /> <span
                        class="input-group-btn"><input type="button" value="选择身份证正面" class="btn green"
                                                       onclick="upImage(1);"></span></div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('姓名')}<span style="color:red">*</span>:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-learned_name" class="form-control" name="row[learned_name]" type="text" value="" data-rule="required">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('证件类型')}<span style="color:red">*</span>:</label>
                <div class="col-xs-12 col-sm-8">
                    <select name="row[learned_kind]" id="c-learned_kind" class="form-control">
                        <option value="0">身份证</option>
                        <option value="1">统一社会信用代码</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('证件号')}<span style="color:red">*</span>:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-learned_num" class="form-control" name="row[learned_num]" type="text" value="" >
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{:__('手机')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-learned_phone" class="form-control" name="row[learned_phone]" type="text" value="">
                </div>
            </div>
            <!--            <div class="form-group layer-footer">-->
            <!--                <label class="control-label col-xs-12 col-sm-2"></label>-->
            <!--                <div class="col-xs-12 col-sm-8">-->
            <!--                    <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('暂存')}</button>-->
            <!--                    <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('暂存')}</button>-->
            <!--                </div>-->
            <!--            </div>-->
        </div>
    </div>

    <div class="tabs">
        <div class="tab-labels">
            <div class="xian"></div>
            <label class="tab-label active" for="tab1">车辆信息</label>
            <label class="tab-label" for="tab2" id="tab22">服务项目</label>
            <!--            <label class="tab-label" for="tab3">特约及争议解决方式</label>-->
            <label class="tab-label" for="tab4" id="tab44">影像资料</label>
        </div>
        <div class="tabs-content">
            <div id="tab1" class="tab active">
                <input type="hidden" id="c-car_leixing" name="row[car_leixing]">
                <input type="hidden" name="row[car_lastyear]" id="car_lastyear" value="0" readonly=""/>
                <input type="hidden" name="row[haocolor]" id="haocolor" value="0" readonly=""/>
                <input type="hidden" name="row[gs_type]" id="gs_type" value="" />

                <div class="left">
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Plan_strattime')}:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-plan_strattime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[plan_strattime]" type="text" value="{:date('Y-m-d 00:00:00', strtotime('+1 days'))}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Yw_come')}<span style="color:red">*</span>:</label>
                        <div class="col-xs-12 col-sm-10">
                            <?php if(in_array(205,$rule)){ ?>
                            <!--                            {:build_select('row[yw_come]', $jigoudata, '', ['class'=>'form-control', 'required'=>'required','id'=>'yw_come'])}-->
                            <input id="yw_come" class="form-control" name="row[yw_come]" type="text" value="直属业务" readonly>
                            <?php }else{ ?>
                            <input id="yw_come" class="form-control" name="row[yw_come]" type="text" value="{$zuzhi.jigou}" readonly>
                            <?php } ?>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Car_num')}<span style="color:red">*</span>:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-car_num" class="form-control" name="row[car_num]" type="text" style="width: calc(100% - 70px)" data-rule="required">
                            <input type="checkbox" style="width: 20px;height: 20px;margin:5px;"
                                   name="row[car_is_new]" value="2" id="isnew">
                            <font style="line-height: 30px;">新车</font>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Car_register')}<span style="color:red">*</span>:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-car_register" class="form-control" name="row[car_register]" type="text" data-rule="required">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Car_use_nature')}<span style="color:red">*</span>:</label>
                        <div class="col-xs-12 col-sm-10">
                            <select name="row[car_use_nature]" id="c-car_use_nature" class="form-control">
                                <?php foreach($xingzhi as $k => $v){?>

                                <option value="{$v}">{$k}</option>

                                <?php }?>
                                <!--                                <option value="1" selected>营运</option>-->
                                <!-- <option value="7">营业客运</option> -->
                                <!--<option value="6">营业租赁</option>-->
                                <!--                                <option value="10">非营运</option>-->
                                <!--<option value="8">家庭自用车</option> -->
                                <!--<option value="2">特种车一</option>-->
                                <!--<option value="3">特种车二</option>-->
                                <!--<option value="4">特种车三</option>-->
                                <!--                                <option value="5">预约出租客运</option>-->
                                <!--<option value="11">出租营运</option>-->
                                <!--<option value="12">出租租赁</option>-->
                                <!--<option value="13">营运货车</option>-->
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Car_carry_peo')}<span style="color:red">*</span>:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-car_carry_peo" class="form-control" name="row[car_carry_peo]" type="number">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Car_curb_weight')}:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-car_curb_weight" class="form-control" name="row[car_curb_weight]" type="text">
                        </div>
                    </div>
                </div>
                <div class="zhong">
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Plan_endtime')}:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-plan_endtime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[plan_endtime]" type="text" value="{:date('Y-m-d 23:59:59', strtotime('+1 year'))}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Yw_class')}<span style="color:red">*</span>:</label>
                        <div class="col-xs-12 col-sm-10">
                            <?php if(in_array(205,$rule)){ ?>
                            <?php if(in_array(471,$rule)){ ?>
                            <input id="yw_class" data-rule="required" data-source="lists/one/zuzhi" class="form-control selectpage yw_classs" name="row[yw_class]" type="text" value="" placeholder="请选择组织">
                            <?php }else{ ?>
                            <input id="yw_class" data-rule="required" data-source="lists/one/zuzhi" class="form-control selectpage" name="row[yw_class]" type="text" value="" placeholder="请选择组织">
                            <?php } ?>
                            <?php }else{ ?>
                            <input class="form-control" type="text" value="{$zuzhi.name}" readonly>
                            <input id="yw_class" class="form-control" name="row[yw_class]" type="hidden" value="{$zuzhi.id}" readonly>
                            <?php } ?>
                        </div>
                    </div>
                    <div class="form-group" style="position: relative">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Car_vin')}<span style="color:red">*</span>: <div id="lishi" style="position:absolute;left:90px;top:0px;border: 1px solid;padding: 2px 4px 2px 4px;border-radius: 5px;cursor: pointer">历史记录</div></label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-car_vin" class="form-control" name="row[car_vin]" type="text" value="" data-rule="required">

                        </div>
                        <div id="che_sou" style="position:absolute;right: 38px;top: 31px;background: #1E9FFF;color: #fff;padding: 2px 4px 2px 4px;border-radius: 5px;">搜索</div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Chexing')}<span style="color:red">*</span>:</label>
                        <div class="col-xs-12 col-sm-10">

                            <select name="row[chexing]" id="c-chexing"  class="form-control" data-rule="required">
                                <option value="">请选择车辆类型</option>
                                <?php foreach($chexing as $k => $v){?>

                                <option value="{$v}">{$k}</option>

                                <?php }?>
                                <!--                                <option value="">请选择车辆类型</option>-->
                                <!--                                <option value="货车">2吨以上货车</option>-->
                                <!--                                <option value="挂车">挂车</option>-->
                                <!--                                &lt;!&ndash;<option value="二吨至五吨货车">二吨至五吨货车</option>&ndash;&gt;-->
                                <!--                                &lt;!&ndash;<option value="五吨至十吨货车">五吨至十吨货车</option>&ndash;&gt;-->
                                <!--                                &lt;!&ndash;<option value="十吨以上货车">十吨以上货车</option>&ndash;&gt;-->

                                <!--                                <option value="自卸车">自卸车</option>-->
                                <!--                                <option value="特二">特二</option>-->
                                <!--                                <option value="2吨以下" >2吨以下货车</option>-->
                                <!--                                <option value="网约车" >网约或出租</option>-->
                                <!--                                <option value="预约出租客运" >预约出租客运</option>-->

                                <!--                                &lt;!&ndash;<option value="家庭自用车" >私家车</option>&ndash;&gt;-->
                                <!--                                <option value="6座以下" >6座以下(私家车)</option>-->
                                <!--                                <option value="6-10座" >6-10座(私家车)</option>-->

                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Car_carry_quality')}<span style="color:red">*</span>:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-car_carry_quality" class="form-control" name="row[car_carry_quality]" type="text" data-rule="required">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Car_reall')}:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-car_reall" class="form-control" name="row[car_reall]" type="text">
                        </div>
                    </div>
                </div>
                <div class="right">
                    <div class="form-group" style="height: 62px;padding-top: 25px;">
                        <label class="control-label col-xs-12" style="width: 20%;text-align: left;padding-right: 0;">服务天数:</label>
                        <div class="col-xs-12 col-sm-8" style="margin-top: 7px;padding-left: 0;" id="datecount">
                            365天
                        </div>
                    </div>
                    <!--                    <div class="form-group" style="height: 62px;">-->
                    <!--                        <label class="control-label col-xs-12" style="width: 20%;text-align: left;padding-right: 0;"></label>-->
                    <!--                        <div class="col-xs-12 col-sm-10" style="margin-top: 7px;padding-left: 0;">-->

                    <!--                        </div>-->
                    <!--                    </div>-->
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Yw_belonger')}:</label>
                        <div class="col-xs-12 col-sm-10">
                            <?php if(in_array(471,$rule)){ ?>
                            <select name="row[yw_belonger]" id="guishu"  class="form-control">
                                <option value="">请选择归属人</option>

                            </select>
                            <?php }else{ ?>
                            <input id="c-yw_belonger" class="form-control" name="row[yw_belonger]" type="text" value="{$admin.username}" readonly>
                            <?php } ?>

                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Car_engine')}<span style="color:red">*</span>:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-car_engine" class="form-control" name="row[car_engine]" type="text" data-rule="required">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Chexing_ci')}<span style="color:red">*</span>:</label>
                        <div class="col-xs-12 col-sm-10">
                            <select name="row[chexing_ci]" id="ncd"  class="form-control" data-rule="required">
                                <option value="">请选择出险情况</option>

                            </select>

                            <input type="hidden" name='row[ncd]' id="chexing_ci" value=''>
                            <input type="hidden" name='row[feiyong]' id="feiyong" value=''>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Car_buy')}:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-car_buy" class="form-control" name="row[car_buy]" type="text">
                        </div>
                    </div>
                </div>
                <div class="right">
                    <div class="form-group" style="height: 62px;">
                        <input name="file" id="file" type="hidden" class="form-control" value="" /> <span
                            class="input-group-btn"><input type="button" value="选择行驶证" class="btn green"
                                                           onclick="upImage(2);"></span>
                    </div>
                    <div class="form-group" style="height: 62px;">
                        <label class="control-label col-xs-12" style="width: 20%;text-align: left;padding-right: 0;"></label>
                        <div class="col-xs-12 col-sm-10" style="margin-top: 7px;padding-left: 0;">

                        </div>
                    </div>
                    <div class="form-group" style="position: relative">
                        <label class="control-label col-xs-12 col-sm-2">{:__('Car_factory_num')}<span style="color:red">*</span>:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input id="c-car_factory_num" class="form-control" name="row[car_factory_num]" type="text"  data-rule="required">

                        </div>
                        <div id="chang_sou" style="position:absolute;right: 38px;top: 31px;background: #1E9FFF;color: #fff;padding: 2px 4px 2px 4px;border-radius: 5px;">搜索</div>
                    </div>
                    <input type="hidden" name="row[main_sumdiscount]" class="form-control" id="main_sumdiscount" value="0"/>

                    <?php if(in_array(219,$rule)){ ?>
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{:__('折扣')}<span style="color:red">*</span>:</label>
                        <div class="col-xs-12 col-sm-10">
                            <input type="text" name="row[main_sumdiscount]" class="form-control" id="addz" value="0" data-rule="required"/>
                        </div>
                    </div>
                    <?php }else{ ?>
                    <input type="hidden" name="row[main_sumdiscount]" class="form-control" id="addz" value="0" data-rule="required"/>
                    <?php } ?>
                </div>

                <div class="form-group " style="margin-top: 50px;padding-bottom: 50px;">
                    <label class="control-label col-xs-12 col-sm-2"></label>
                    <div class="col-xs-12 " style="text-align: center;margin: auto;">
                        <!--                        <button type="button" class="btn btn-primary btn-embossed " style="margin-left: 10px;" onclick="zancuns()">{:__('暂存')}</button>-->
                        <button type="submit" class="btn btn-primary btn-embossed ">{:__('暂存')}</button>
                        <button  class="tab-label1 btn btn-primary btn-embossed" style="width:100px;" type="button" >下一步</button>
                    </div>
                </div>
            </div>
            <div id="tab2" class="tab">
                <div class="form-group row">
                    <!--                    <label class="control-label col-xs-12">{:__('Fieldlist二维数组示例')}:</label>-->
                    <div class="col-xs-12">
                        <table class="table fieldlist" data-template="basictpl" data-name="row[basic]" id="first-table">
                            <tr class="tcxm-td">
                                <td><input type="checkbox" name="" id="checks"></td>
                                <td>{:__('主服务项目')}</td>
                                <td>{:__('服务金额')}</td>
                                <td>{:__('不计免赔')}</td>
                                <td>{:__('标准服务费')}</td>
                                <td>{:__('折扣(%)')}</td>
                                <td>{:__('应缴服务费')}</td>
                                <!--                                <td width="100"></td>-->
                            </tr>
                            <!--                            机动车损失服务-->
                            <tr class="form-inline">
                                <td style="text-align: center">
                                    <input type="checkbox" name="row[main_name]" id="main_name" value="1" class="chk">
                                </td>
                                <td>机动车损失服务</td>
                                <td><input type="text" name="row[main_money]" id="main_money" class="form-control" size="15" value="" placeholder="" readonly/></td>
                                <td style="text-align: center">
                                    <input type="checkbox" value="1" name="row[main_franchise]" id="main_franchise" disabled>
                                    <input type="hidden" value="2" name="row[main_franchise]">
                                </td>
                                <td><input type="text" name="row[main_standard]" id="main_standard" class="form-control zongshu" value="" readonly/></td>
                                <td><input type="text" name="row[main_discount]" id="sun" class="form-control"  value="" readonly /></td>
                                <td><input type="text" name="row[main_submit]" id="main_submit" class="form-control zong_tongchou" value="" readonly/></td>
                            </tr>
                            <!--                            机动车损失服务-->
                            <tr class="form-inline">
                                <td style="text-align: center">
                                    <input type="checkbox" name="row[main_disan]" id="main_disan" value="1" class="chk">
                                </td>
                                <td>机动车第三者责任服务</td>
                                <td>
                                    <select name="row[main_santong]" id="main_santong" class="form-control" style="width: 100%">
                                        <option value="">请选择</option>
                                        <option value="3000000">300万</option>
                                        <option value="2000000">200万</option>
                                        <option value="1500000">150万</option>
                                        <option value="1000000">100万</option>
                                        <option value="500000">50万</option>
                                        <!--                                        <option value="300000">30万</option>-->
                                        <!--                                        <option value="200000">20万</option>-->
                                        <!--                                        <option value="100000">10万</option>-->
                                        <!--                                        <option value="50000">5万</option>-->
                                    </select>
                                </td>
                                <td style="text-align: center">
                                    <input type="checkbox" value="1" name="row[main_ji]" id="main_ji" disabled/>
                                    <input type="hidden" value="2" name="row[main_ji]">
                                </td>
                                <td>
                                    <input type="text" name="row[main_biao]" id="main_biao" class="form-control zongshu" value=""/>
                                    <input type="hidden" id="main_biao1" value="0"/>
                                </td>
                                <td><input type="text" name="row[main_zhe]" id="san" class="form-control"  value="" readonly/></td>
                                <td><input type="text" name="row[main_yingjiao]" id="main_yingjiao" class="form-control zong_tongchou" value="" readonly/></td>
                            </tr>
                            <!--                            机动车损失服务-->
                            <tr class="form-inline">
                                <td style="text-align: center">
                                    <input type="checkbox" name="row[siji]" id="si_jis" value="1" class="chk">
                                </td>
                                <td>车上人员责任服务(司机)<input type="text" class="form-control" value="1" style="text-align: center" disabled/></td>
                                <td>
                                    <select name="row[siji_tong]" id="siji_tong" style="width: 100%" class="form-control">
                                        <option value="">请选择</option>
                                        <option value="10000">1万</option>
                                        <option value="20000">2万</option>
                                        <option value="30000">3万</option>
                                        <option value="40000">4万</option>
                                        <option value="50000">5万</option>
                                        <!--                                        <option value="60000">6万</option>-->
                                        <!--                                        <option value="70000">7万</option>-->
                                        <!--                                        <option value="80000">8万</option>-->
                                        <!--                                        <option value="90000">9万</option>-->
                                        <option value="100000">10万</option>
                                        <option value="200000">20万</option>
                                        <!--                                        <option value="300000">30万</option>-->
                                        <!--                                        <option value="500000">50万</option>-->
                                    </select>
                                </td>
                                <td style="text-align: center">
                                    <input type="checkbox" value="1" name="row[siji_ji]" id="siji_ji" disabled/>
                                    <input type="hidden" value="2" name="row[siji_ji]">
                                </td>
                                <td><input type="text" name="row[siji_biao]" id="siji_biao" class="form-control zongshu" value=""/>
                                    <input type="hidden" id="siji_biao1" value="0"/></td>
                                <td><input type="text" name="row[siji_zhe]" id="siji" class="form-control"  value="" readonly/></td>
                                <td><input type="text" name="row[siji_ying]" id="siji_ying" class="form-control zong_tongchou" value="" readonly/></td>
                            </tr>
                            <!--                            机动车损失服务-->
                            <tr class="form-inline">
                                <td style="text-align: center">
                                    <input type="checkbox" name="row[chengke]" id="chengkess" value="1" class="chk">
                                </td>
                                <td>车上人员责任服务(乘客)<input type="text" name="row[chengke_zuo]" id="zuo" class="form-control" size="15" value="" style="text-align: center" readonly/>座</td>
                                <td>

                                    <input type="hidden" name="row[ck_tong]" id="ck_tong" value="" readonly="readonly"
                                           style="width: 100%;height: 100%;border: none;margin: 0;">
                                    <select name="row[ck_money]" id="ck" style="width:100%;" class="form-control">
                                        <option value="">请选择</option>
                                        <option value="10000">1万</option>
                                        <option value="20000">2万</option>
                                        <option value="30000">3万</option>
                                        <option value="40000">4万</option>
                                        <option value="50000">5万</option>
                                        <!--                                        <option value="60000">6万</option>-->
                                        <!--                                        <option value="70000">7万</option>-->
                                        <!--                                        <option value="80000">8万</option>-->
                                        <!--                                        <option value="90000">9万</option>-->
                                        <option value="100000">10万</option>
                                        <option value="200000">20万</option>
                                    </select>
                                </td>
                                <td style="text-align: center">
                                    <input type="checkbox" name="row[ck_ji]" id="ck_ji" value="1" disabled/>
                                    <input type="hidden" name="row[ck_ji]" value="2"/>
                                </td>
                                <td><input type="text" name="row[ck_biao]" id="ck_biao" class="form-control zongshu" value=""/>
                                    <input type="hidden" id="ck_biao1" value="0"/></td></td>
                                <td><input type="text" name="row[ck_zhe]" id="cheng" class="form-control"  value="" readonly/></td>
                                <td><input type="text" name="row[ck_ying]" id="ck_ying" class="form-control zong_tongchou" value="" readonly/></td>
                            </tr>
                            <tr class="tcxm-td">
                                <td>	<input type="checkbox" lay-filter="checkall" name="" id="checkss"></td>
                                <td>{:__('附加服务项目')}</td>
                                <td>{:__('服务金额')}</td>
                                <td>{:__('不计免赔')}</td>
                                <td>{:__('标准服务费')}</td>
                                <td>{:__('折扣(%)')}</td>
                                <td>{:__('应缴服务费')}</td>
                                <!--                                <td width="100"></td>-->
                            </tr>
                            <!--                            机动车损失服务-->
                            <tr class="form-inline">
                                <td style="text-align: center">
                                    <input type="checkbox" name="row[dao_name]" id="dao_name" value="1" class="chks">
                                </td>
                                <td>三者医保外用药</td>
                                <td>
                                    <select name="row[dao_tong]" id="dao_tong" class="form-control" style="width: 100%">
                                        <option value="">请选择</option>
                                        <!--                                        <option value="10000">1万</option>-->
                                        <!--                                        <option value="20000">2万</option>-->
                                        <option value="50000">5万</option>
                                        <option value="100000">10万</option>
                                        <!--                                        <option value="200000">20万</option>-->
                                        <!--                                        <option value="300000">30万</option>-->
                                        <!--                                        <option value="500000">50万</option>-->
                                    </select>
                                </td>
                                <td style="text-align: center">
                                    <input type="checkbox" value="1" name="row[dao_ji]" id="dao_ji" disabled/>
                                    <input type="hidden" value="2" name="row[dao_ji]"/>
                                </td>
                                <td><input type="text" name="row[dao_biao]" id="dao_biao" class="form-control zongshu" value=""  readonly/></td>
                                <td><input type="text" name="row[dao_zhe]" id="dao" class="form-control"  value="100" readonly/></td>
                                <td><input type="text" name="row[dao_ying]" id="dao_ying" class="form-control zong_tongchou" value="" readonly/></td>
                            </tr>
                            <tr class="form-inline">
                                <td style="text-align: center">
                                    <input type="checkbox" name="row[dianwang]" value="1" id="dianwangs" class="chks">
                                </td>
                                <td>附加外部电网故障损失险</td>
                                <td><input type="text" name="row[dw_tong]" id="dw_tong" class="form-control" size="15" value="" placeholder=""  readonly/></td>
                                <td style="text-align: center">
                                    <input type="checkbox" name="row[dw_ji]" id="dw_ji" value="1" disabled/>
                                    <input type="hidden" name="row[dw_ji]" value="2" />
                                </td>
                                <td><input type="text" name="row[dw_biao]" id="dw_biao" class="form-control zongshu" value=""  readonly/></td>
                                <td><input type="text" name="row[dw_zhe]" id="dw" class="form-control"  value="100" readonly/></td>
                                <td><input type="text" name="row[dw_ying]" id="dw_ying" class="form-control zong_tongchou" value="" readonly/></td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="form-group">
                    <div class="left">
                        <div class="form-group">
                            <label class="control-label col-xs-12 col-sm-2">{:__('交强')}:</label>
                            <div class="col-xs-12 col-sm-10">
                                <input type="text" class="form-control" placeholder="请输入交强" name="row[jq_price]" id="jq_price" oninput="vs()" onpropertychange="vs()" value="">
                            </div>
                        </div>
                    </div>
                    <div class="zhong">
                        <div class="form-group">
                            <label class="control-label col-xs-12 col-sm-2">{:__('车船税')}:</label>
                            <div class="col-xs-12 col-sm-10">
                                <input type="text" class="form-control" placeholder="请输入车船税" name="row[cc_price]" id="cc_price" oninput="vs()" onpropertychange="vs()" value="">
                            </div>
                        </div>
                    </div>
                    <div class="right">
                        <div class="form-group">
                            <label class="control-label col-xs-12 col-sm-2">{:__('标准服务费（合计）')}:</label>
                            <div class="col-xs-12 col-sm-10">
                                <input type="text" class="form-control"  placeholder="请输入标准服务费（合计）" name="row[main_sum]" id="main_sum" oninput="vs()" onpropertychange="vs()" value="" readonly="readonly">
                            </div>
                        </div>
                    </div>
                    <div class="right">
                        <div class="form-group">
                            <label class="control-label col-xs-12 col-sm-2">{:__('服务费（合计）')}:</label>
                            <div class="col-xs-12 col-sm-10">
                                <input type="text" class="form-control"  placeholder="请输入服务费（合计）" name="row[main_free]" id="main_free" oninput="vs()" onpropertychange="vs()" value="" readonly="readonly">
                            </div>
                        </div>
                    </div>
                </div>

                <div class="form-group " style="margin-top: 50px;padding-bottom: 50px;">
                    <label class="control-label col-xs-12 col-sm-2"></label>
                    <div class="col-xs-12 " style="text-align: center;margin: auto;">
                        <!--                        <button type="submit" class="btn btn-primary btn-embossed ">{:__('暂存')}</button>-->
                        <!--                        <button type="button" class="btn btn-primary btn-embossed " style="margin-left: 10px;" onclick="ajaxPost()">{:__('提交审核')}</button>-->

                        <button  class="tab-label2 btn btn-primary btn-embossed" style="width:100px;" type="button" >下一步</button>
                        <button type="button" class="btn btn-primary btn-embossed " style="margin-left: 10px;" onclick="zancuns()">{:__('暂存且生成报价单')}</button>
                    </div>
                </div>
            </div>
            <div id="tab3" class="tab">
                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2" style="width: 110px;">{:__('争议解决方')}:</label>
                    <div class="col-xs-12 col-sm-8" style="top: 7px;left: 0">
                        <input type="radio" name="row[resolvent]" value="1" checked/> 诉讼
                        <input type="radio" name="row[resolvent]" value="2"/>仲裁
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">{:__('特别约定')}:</label>
                    <div class="col-xs-12 col-sm-10">
                        <textarea name="row[special]" rows="5" cols="10" id="txt" value="" readonly="" class="form-control" style="background: #fff;">无其他特别约定</textarea>
                    </div>
                </div>
            </div>
            <div id="tab4" class="tab" style="min-height: 300px;">
                <label for="c-file" class="control-label col-xs-12 col-sm-2">{:__('选择资料')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <div class="input-group" style="display: block;">
                        <!--                        <input id="c-file" class="form-control" size="35" name="row[file]" type="text" value="">-->
                        <div class="input-group-addon no-border no-padding" style="width: 100%;">
                            <span><button type="button" id="faupload-file" class="btn btn-danger faupload" data-input-id="c-file" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-file"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                            <span><button type="button" id="fachoose-file" class="btn btn-primary fachoose" data-input-id="c-file" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                        </div>
                        <textarea id="c-file" class="form-control" name="row[file]" style="margin-top: 10px" rows="5"></textarea>
                        <span class="msg-box n-right"></span>
                    </div>
                    <ul class="row list-inline faupload-preview" id="p-file"></ul>
                </div>
                <div id="xiang"></div>
                <!--	<div class="conts" id="files" style="margin-top:30px;">-->
                <!--	<div class="input-group"><input name="file" id="file" type="hidden" class="form-control" value="" /> <span-->
                <!--			class="input-group-btn"><input type="button" value="选择身份证正面" class="btn green"-->
                <!--				onclick="upImage(1);"></span></div>-->
                <!--</div>-->
                <div id="xiang1"></div>

                <!--<div class="conts" id="files" style="margin-top:30px;">-->
                <!--	<div class="input-group"><input name="file" id="file" type="hidden" class="form-control" value="" /> <span-->
                <!--			class="input-group-btn"><input type="button" value="选择行驶证" class="btn green"-->
                <!--				onclick="upImage(2);"></span></div>-->
                <!--</div>-->
                <div id="xiang2"></div>

                <input type="hidden" id="cardtype">

                <div class="form-group " style="margin-top: 100px;padding-bottom: 50px;">
                    <label class="control-label col-xs-12 col-sm-2"></label>
                    <div class="col-xs-12 " style="text-align: center;margin: auto;">
                        <button type="submit" class="btn btn-primary btn-embossed ">{:__('暂存')}</button>
                        <button type="button" class="btn btn-primary btn-embossed " style="margin-left: 10px;" onclick="ajaxPost()">{:__('提交审核')}</button>
                        <!--                        <button type="button" class="btn btn-primary btn-embossed " style="margin-left: 10px;" onclick="zancuns()">{:__('暂存且生成报价单')}</button>-->
                    </div>
                </div>

            </div>
        </div>
    </div>

    <!--全部搜索的弹窗-->
    <div class="modal fade" id="myModal_quan" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width:1300px!important;">
            <div class="modal-content" >
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title">
                        请选择
                    </h4>

                </div>
                <div class="modal-body" >
                    <table class="layui-table" border="1" width="100%" style="text-align:center;">
                        <thead>
                        <tr>
                            <th>姓名</th>
                            <th>联系电话</th>
                            <th>地址</th>
                            <th>身份证</th>
                            <th>车牌号</th>
                            <th>车架号</th>
                            <th>发动机号</th>
                            <th>品牌车型</th>
                            <th>初登时间</th>
                            <th>服务起期</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody id="quansou_xuanze">
                        <tr>
                            <td>11</td>
                            <td>12</td>
                            <td>13</td>
                            <td>14</td>
                            <td>13</td>
                            <td>11</td>
                            <td>12</td>
                            <td>13</td>
                            <td>14</td>
                            <td>13</td>
                            <td><button type="button" class="layui-btn layui-btn-normal layui-btn-radius">选择</button></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <!--车架号搜索弹窗-->
    <div class="modal fade" id="myModal_chejia" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width:900px!important;">
            <div class="modal-content" >
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title">
                        请选择
                    </h4>

                </div>
                <div class="modal-body" >
                    <table class="layui-table" border="1" width="100%" style="text-align:center;">
                        <thead>
                        <tr>
                            <th>厂牌型号</th>
                            <th>核定载客(人)</th>
                            <th>核定载质量/准牵引总质量(kg)*</th>
                            <th>新车购置价</th>
                            <th>整备质量(kg)</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody id="chejia_xuanze">
                        <tr>
                            <td>11</td>
                            <td>12</td>
                            <td>13</td>
                            <td>14</td>
                            <td>13</td>
                            <td><button type="button" class="layui-btn layui-btn-normal layui-btn-radius">选择</button></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <!--厂牌型号搜索弹窗-->
    <div class="modal fade" id="myModal_changpai" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width:900px!important;">
            <div class="modal-content" >
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title">
                        请选择
                    </h4>

                </div>
                <div class="modal-body" >
                    <table class="layui-table" border="1" width="100%" style="text-align:center;">
                        <thead>
                        <tr>
                            <th>车架号</th>
                            <th>核定载客(人)</th>
                            <th>核定载质量/准牵引总质量(kg)*</th>
                            <th>新车购置价</th>
                            <th>整备质量(kg)</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody id="changpai_xuanze">
                        <tr>
                            <td>11</td>
                            <td>12</td>
                            <td>13</td>
                            <td>14</td>
                            <td>13</td>
                            <td><button type="button" class="layui-btn layui-btn-normal layui-btn-radius">选择</button></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <!-- 上传图片弹窗-->
    <div class="page-container uploadBox0" id="uploadBox0" >
        <div id="uploader" class="wu-example">
            <div class="queueList" style="position:relation">
                <div class="closee" onclick="closee()">×</div>
                <div id="dndArea" class="placeholder">
                    <div id="filePicker" class="webuploader-container"><div class="webuploader-pick">点击选择图片</div><div id="rt_rt_1fs5sqsmsnib1fi1ju216431h8r1" style="position: absolute; inset: 0px auto auto 448px; width: 168px; height: 44px; overflow: hidden;"><input type="file" name="file" class="webuploader-element-invisible" multiple="multiple" accept="image/*"><label style="opacity: 0; width: 100%; height: 100%; display: block; cursor: pointer; background: rgb(255, 255, 255);"></label></div></div>
                    <p>或将照片拖到这里，单次最多可选300张</p>
                    <p style="padding-top:10px;font-size:14px;color:red">请上传被服务人身份证正反面、行驶证正副本、报价单等</p>
                </div>
                <!--<ul class="filelist"></ul>-->
            </div>
            <div class="statusBar" style="display:none;">
                <div class="progress" style="display: none;">
                    <span class="text">0%</span>
                    <span class="percentage" style="width: 0%;"></span>
                </div><div class="info">共0张（0B），已上传0张</div>
                <div class="btns">
                    <div id="filePicker2" class="webuploader-container"><div class="webuploader-pick">继续添加</div><div id="rt_rt_1fs5sqsn05kanb01eplhnf8qm6" style="position: absolute; top: 0px; left: 0px; width: 140px; height: 1px; overflow: hidden;"><input type="file" name="file" class="webuploader-element-invisible" multiple="multiple" accept="image/*"><label style="opacity: 0; width: 100%; height: 100%; display: block; cursor: pointer; background: rgb(255, 255, 255);"></label></div></div><div class="uploadBtn state-pedding" id="shangchuan">开始上传</div>
                </div>
            </div>
        </div>
    </div>
    <style>
        input:-internal-autofill-previewed,
        input:-internal-autofill-selected {
            -webkit-text-fill-color: black !important;
            transition: background-color 5000s ease-in-out 0s !important;
        }
        .dong{
            width: 10% !important;
        }
        .page-content{background: #F0F1F5;}
        .chakan{
            width:100%;
            /*margin: 1% 0;*/
            padding:20px 0;
            background: #fff;
        }
        .chakan-menu{
            width:98%;
            margin:1%;
            height:50px;
            line-height:50px;
        }
        .chakan-menu li{
            float: left;
            /*width:12.5%;*/
            width:8%;
            height: 100%;
            text-align:center;
            list-style: none;
        }
        .chakan-menu li a{
            /*width:100px;*/
            display: block;
            height:35px;
            line-height: 35px;
            margin:7.5px 0;
            text-decoration: none;
        }
        .chakan-menu li a.current{
            background:#3683D3;
            color: #fff;
            border-radius:5px;
        }
        .chakan-content{
            width:98%;
            margin:1%;
        }
        .chakan-content>div{
            display: none;
        }
        .chakan-content>div.ck-current{
            display:block;
        }
        .layui-table tr th,td{
            text-align: center;
        }
        .btns1{
            width:15%;
            display: flex;
            margin:80px auto;
        }
        .btns1 button{
            width:80px;
            height:30px;
            margin:10px;
            background: #3683D3;
            color: #fff;
            text-align: center;
            border:none;
            -webkit-border-radius:5px;
            -moz-border-radius:5px;
            border-radius:5px;
        }
        .btns1 a{
            display: block;
            width:80px;
            height:30px;
            margin:10px;
            line-height: 30px;
            background: #3683D3;
            color: #fff;
            text-align: center;
            border:none;
            -webkit-border-radius:5px;
            -moz-border-radius:5px;
            border-radius:5px;
        }
        /*.layui-table  tr td:nth-child(1) input{*/
        /*width:10px;*/
        /*height:10px;*/
        /*border:1px;*/
        /*}*/
        .layui-table  tr td input{
            width:100%;
            /*height:99%;*/
            border:none;
        }
        /* 鼠标指向表格时,奇数行背景颜色 */
        .layui-table tbody tr:hover,.layui-table-hover {
            background-color: #E6E6E6;
        }
        #he tr td{
            padding:0;
        }
        #he tr td:nth-child(1){
            padding:2px 13px;
        }
        #he1 tr td{
            padding:0;
        }
        #he1 tr td:nth-child(1){
            padding:2px 13px;
        }
        #he2 tr td{
            padding:0;
        }
        #he2 tr td:nth-child(1){
            padding:2px 13px;
        }
        #he3 tr td{
            padding:0;
        }
        #he3 tr td:nth-child(1){
            padding:2px 13px;
        }
        #he4 tr td{
            padding:0;
        }
        #he4 tr td:nth-child(1){
            padding:2px 13px;
        }
        #he5 tr td{
            padding:0;
        }
        #he5 tr td:nth-child(1){
            padding:2px 13px;
        }
        #he6 tr td{
            padding:0;
        }
        #he6 tr td:nth-child(1){
            padding:2px 15px;
        }
        form table{
            margin:10px 0 0 0 !important;
        }
        #he,#he1,#h2,#h3,#h4,#h5,#h6{
            margin:0 !important;
        }
        /* 上传文件样式 */
        .black_overlay{
            display: none;
            position: absolute;
            top: 0%;
            left: 0%;
            width: 100%;
            height: 100%;
            background-color: black;
            z-index:1001;
            -moz-opacity: 0.8;
            opacity:.80;
            filter: alpha(opacity=88);
        }
        .white_content {
            display: none;
            position: fixed;
            top:10%;
            width:85%;
            height:80%;
            padding: 20px;
            border: 2px solid cornflowerblue;
            background-color: white;
            z-index:1002;
            overflow: auto;
        }
        .uploadBox0{
            z-index:10000;position:fixed;
            left: 50%;
            margin-left: -250px;
            top: 50%;
            margin-top: -200px;
            background: #fafafa;
            width:500px;
            height: 400px;
            display: none;
        }

        #uploader .placeholder{
            min-height: 400px;
            box-sizing:border-box;
            padding-top: 120px;
        }
        .closee{
            position: absolute;
            right:-12px;
            top:-12px;
            font-size: 18px;
            background:#ccc;
            width: 30px;
            height:30px;
            line-height: 30px;
            text-align: center;
            border-radius: 50%;
            cursor: pointer;
        }
        #filePicker div{
            width:168px!important;
            height:44px!important;
            inset: 0px auto auto 143px!important;
        }
        #filePicker .webuploader-pick{
            width:168px!important;
            height:44px!important;
            inset: 0px auto auto 0px!important;
        }
        #uploader .statusBar .btns{
            width:auto!important;
        }
    </style>

</form>

<script src="/assets/libs/jquery/dist/jquery.js"></script>
<link rel="stylesheet" type="text/css" href="/assets/js/webuploder/css/webuploader.css">
<link rel="stylesheet" type="text/css" href="/assets/js/webuploder/css/demo.css">
<script src='/assets/js/webuploder/webuploader/webuploader.min.js'></script>
<script src='/assets/js/webuploder/webuploader/demo3.js'></script>
<script>
    $(document).ready(function() {
        $('.tab-label').click(function() {
            // 移除所有标签的激活状态和内容的显示状态
            $('.tab-label, .tab').removeClass('active');
            // 添加激活状态到点击的标签和对应的内容
            $(this).addClass('active');
            $('#' + $(this).attr('for')).addClass('active');
        });
    });
    //搜索
    $("#che_sou").on("click", function() {
        var code=$("#c-car_vin").val()
        if(code==''){
            layer.alert("请输入车架号")
            return false;
        }
        $.ajax({
            type: 'get',
            url: "/api/index/ceshivin", //发送路径
            data: {
                vinCode:code

            }, //发送的数据
            //   dataType: 'json',
            async: false, //是否异步
            success: function(res) {
                console.log(res)
                if(res.code==1){
                    if(res.data.length==1){
                        layer.msg('查询成功')
                        var arr=res.data[0]
                        $("#c-car_factory_num").val(arr.standardname)//厂牌型号
                        $("#c-car_carry_peo").val(arr.seat)//核定载客（人）

                        var tonnage = arr.tonnage *1000;
                        $("#c-car_carry_quality").val(tonnage)//核定载质量/准牵引总质量（kg）
                        gaibianff()
                        $("#c-car_buy").val(arr.purchaseprice)//新车购置价
                        $("#c-car_curb_weight").val(arr.fullweight)//整备质量（kg）
                        vs()
                        jisuan()
                    }else{
                        var html=''
                        console.log('array',res.data)
                        for(var i=0;i<res.data.length;i++){
                            var tonnage = res.data[i].tonnage *1000;
                            html+=` <tr>
    			                        <td>`+res.data[i].standardname+`</td>
                                        <td>`+res.data[i].seat+`</td>
                                        <td>`+tonnage+`</td>
                                        <td>`+res.data[i].purchaseprice+`</td>
                                        <td>`+res.data[i].fullweight+`</td>

                                        <td><button type="button" class="layui-btn layui-btn-normal layui-btn-radius xuanze" data-index=`+i+`>选择</button></td>
                                        </tr>`
                        }
                        $("#chejia_xuanze").html(html)
                        $("#myModal_chejia").modal();
                        $('body').on('click', '.xuanze', function (e) {
                            console.log(11111111111111)
                            var index=$(this).data("index")
                            var arr=res.data[index]
                            var tonnage = arr.tonnage *1000;
                            console.log('+++++',tonnage)
                            $("#c-car_factory_num").val(arr.standardname)//厂牌型号
                            $("#c-car_carry_peo").val(arr.seat)//核定载客（人）
                            $("#c-car_carry_quality").val(tonnage)//核定载质量/准牵引总质量（kg）
                            console.log('+++++',tonnage)
                            gaibianff();
                            $("#c-car_buy").val(arr.purchaseprice)//新车购置价
                            $("#c-car_curb_weight").val(arr.fullweight)//整备质量（kg）
                            $('#myModal_chejia').modal('hide');
                            vs()
                            jisuan()
                        });
                    }
                }else{
                    layer.alert(res.msg)
                }
            }
        })

    })
    //  核定载质量的改变方法
    $("#c-car_carry_quality").on("input",function(){
        console.log($(this).val())

        gaibianff()
    })
    function gaibianff(){
        console.log('-------',$("#c-c-car_carry_quality").val())
        var z=numDiv($("#c-car_carry_quality").val(),1000)
        console.log('车型',$("#c-chexing").val())
        if($("#c-chexing").val()=='货车-1'){
            z = 10;
        }
        console.log('重量',z)
        if(z<2){
            $("#c-car_leixing").val("二吨以下货车")
        }else if(z>=2 && z<5){
            $("#c-car_leixing").val("二吨至五吨货车")
        }else if(z>=5 && z<10){
            $("#c-car_leixing").val("五吨至十吨货车")
        }else if(z>=10){
            $("#c-car_leixing").val("十吨以上货车")
        }
    }
    //计算
    function jisuan(){
        console.log(2222)
        var riqi=$("#c-car_register").val()
        if($("#c-chexing").val()=='二吨至五吨货车' || $("#c-chexing").val()=='五吨至十吨货车' || $("#c-chexing").val()=='十吨以上货车'|| $("#c-chexing").val()=='挂车'){
            var leixing='货车'
        }else if($("#c-chexing").val() == '6座以下' || $("#c-chexing").val() == '6-10座'){
            var leixing='家庭自用车'
        }else if($("#c-chexing").val() == '预约出租客运'){
            var leixing='网约车'
        }else{
            var leixing=$("#c-chexing").val()
        }
        var car_buy=$("#c-car_buy").val()
        if(!isDate(riqi)){
            layer.msg('初登时间请输入日期格式')
        }
        // 			注册日期到当前日期有几个月
        var monthh=getyue(riqi)
        var bili=0.009;
        $.ajax({
            type: 'get',
            url: "/api/index/sjjz", //发送路径
            data: {
                cartype: leixing

            }, //发送的数据
            //   dataType: 'json',
            async: false, //是否异步
            success: function (res) {
                bili = res.data
            }
        })

        var val1=numMulti(bili,monthh)//比例*几个月
        var val2=numMulti(val1,car_buy)//val1*新车购置价
        var val3=numSub(car_buy,val2)//新车购置价-val2
        if(isNaN(val3)){
            val3 = 0
        }
        $("#c-car_reall").val(val3)
        $("#car_realls").val(val3)

    }
    function isDate(str) {
        // 正则表达式判断日期格式，支持多种格式
        var regEx = /^\d{4}-\d{2}-\d{2}$|^\d{2}\/\d{2}\/\d{4}$|^\d{4}\/\d{2}\/\d{2}$|^\d{2}-\d{2}-\d{4}$|^\d{2}\/\d{2}\/\d{4}$|^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$/;
        return regEx.test(str);
    }
    //  两个日期之间的月份
    function getyue(date1){
        var date1 = new Date(date1); // 第一个日期
        var date2 = new Date(); // 第二个日期
        var year1 = date1.getFullYear(); // 获取第一个日期的年份
        var month1 = date1.getMonth() + 1; // 获取第一个日期的月份，注意月份从0开始，所以需要加1
        var year2 = date2.getFullYear(); // 获取第二个日期的年份
        var month2 = date2.getMonth() + 1; // 获取第二个日期的月份，注意月份从0开始，所以需要加1
        var diffYears = year2 - year1; // 计算年份差值
        var diffMonths = month2 - month1; // 计算月份差值
        var totalMonths = (diffYears * 12) + diffMonths; // 计算相隔的总月数
        // console.log(11111,totalMonths); // 输出相隔的月数
        return totalMonths
    }
    // 乘法
    function numMulti(num1, num2) {
        var baseNum = 0;
        try {
            baseNum += num1.toString().split(".")[1].length;
        }catch (e) {
        }try {
            baseNum += num2.toString().split(".")[1].length;
        }catch (e) {
        }return Number(num1.toString().replace(".", "")) * Number(num2.toString().replace(".", "")) / Math.pow(10, baseNum);
    };
    // 除法
    function numDiv(num1, num2) {
        var baseNum1 = 0, baseNum2 = 0;
        var baseNum3, baseNum4;
        try {
            baseNum1 = num1.toString().split(".")[1].length;
        }catch (e) {
            baseNum1 = 0;
        }try {
            baseNum2 = num2.toString().split(".")[1].length;
        }catch (e) {
            baseNum2 = 0;
        }with (Math) {
            baseNum3 = Number(num1.toString().replace(".", ""));
            baseNum4 = Number(num2.toString().replace(".", ""));
            return (baseNum3 / baseNum4) * pow(10, baseNum2 - baseNum1);
        }
    };
    //减法
    function numSub(num1, num2) {
        var baseNum, baseNum1, baseNum2;
        var precision;// 精度
        try {
            baseNum1 = num1.toString().split(".")[1].length;
        }catch (e) {
            baseNum1 = 0;
        }try {
            baseNum2 = num2.toString().split(".")[1].length;
        }catch (e) {
            baseNum2 = 0;
        }baseNum = Math.pow(10, Math.max(baseNum1, baseNum2));
        precision = (baseNum1 >= baseNum2) ? baseNum1 : baseNum2;
        return ((num1 * baseNum - num2 * baseNum) / baseNum).toFixed(precision);
    };
    //厂牌型号搜索
    $("#chang_sou").on("click", function() {
        var code=$("#c-car_factory_num").val()
        if(code==''){
            layer.alert("请输入厂牌型号")
            return false;
        }
        $.ajax({
            type: 'get',
            url: "/api/index/ceshifgw", //发送路径
            data: {
                fgwCode:code

            }, //发送的数据
            //   dataType: 'json',
            async: false, //是否异步
            success: function(res) {
                console.log(res)

                if(res.code==1){
                    if(res.data.length==1){
                        layer.msg('查询成功')
                        var arr=res.data[0]
                        $("#c-car_factory_num").val(arr.standardname)
                        $("#c-car_carry_peo").val(arr.seat)//核定载客（人）
                        var tonnage = arr.tonnage *1000;
                        if(isNaN(tonnage)){
                            tonnage = 0
                        }
                        $("#c-car_carry_quality").val(tonnage)//核定载质量/准牵引总质量（kg）
                        gaibianff()
                        $("#c-car_buy").val(arr.purchaseprice)//新车购置价
                        $("#c-car_curb_weight").val(arr.fullweight)//整备质量（kg）
                        vs()
                        jisuan()
                        gaibianff()
                    }else{
                        var html=''

                        for(var i=0;i<res.data.length;i++){
                            var tonnage = res.data[i].tonnage *1000;
                            html+=` <tr>
    			                        <td>`+res.data[i].vin+`</td>
                                        <td>`+res.data[i].seat+`</td>
                                        <td>`+tonnage+`</td>
                                        <td>`+res.data[i].purchaseprice+`</td>
                                        <td>`+res.data[i].fullweight+`</td>

                                        <td><button type="button" class="layui-btn layui-btn-normal layui-btn-radius xuanze" data-index=`+i+`>选择</button></td>
                                        </tr>`
                        }
                        $("#changpai_xuanze").html(html)
                        $("#myModal_changpai").modal();
                        $('body').on('click', '.xuanze', function (e) {
                            // console.log(e)
                            var index=$(this).data("index")
                            var arr=res.data[index]
                            var tonnage = arr.tonnage *1000;
                            $("#c-car_factory_num").val(arr.standardname)
                            $("#c-car_carry_peo").val(arr.seat)//核定载客（人）
                            $("#c-car_carry_quality").val(tonnage)//核定载质量/准牵引总质量（kg）
                            console.log('*****')
                            gaibianff()
                            $("#c-car_buy").val(arr.purchaseprice)//新车购置价
                            $("#c-car_curb_weight").val(arr.fullweight)//整备质量（kg）
                            $('#myModal_changpai').modal('hide');
                            console.log('//////')
                            vs()
                            console.log('-----')
                            jisuan()
                            console.log('+++++')
                            gaibianff()
                        });
                    }
                }else{
                    layer.alert(res.msg)
                }
            }
        })
    })
    // 选择车辆类型改变事件
    $("#c-chexing").change(function(){
        console.log('-------',$("#c-chexing").val())
        var value=$(this).val()
// 			console.log('2吨以下（非营运）')
        if(value=='网约车'){
            //号牌底色
            $("#haocolor").val(7)
            //使用性质
            $("#c-car_use_nature").val(5)
            //交管车辆类型
            // $("#car_kind").val('小型汽车')
            //   车辆类型
            // $("#car_leixing").val('6座以下')
            //   号牌种类
            // $("#car_num_kind").val(4)
        }else if(value=='2吨以下'){
            //号牌底色
            $("#haocolor").val(1)
            //使用性质
            $("#c-car_use_nature").val(1)
            //   号牌种类
            // $("#car_num_kind").val(1)
            //交管车辆类型
            // $("#car_kind").val('轻型普通货车')
            //   车辆类型
            // $("#car_leixing").val('二吨以下货车')
        }else if(value == '特二'){
            //号牌底色
            $("#haocolor").val(4)
            //使用性质
            $("#c-car_use_nature").val(3)
            //交管车辆类型
            // $("#car_kind").val('重型特殊结构货车')
            //   车辆类型
            // $("#car_leixing").val('十吨以上货车')
            //   号牌种类
            // $("#car_num_kind").val(0)
        }else if(value == '自卸车'){
            //号牌底色
            $("#haocolor").val(4)
            //使用性质
            $("c-car_use_nature").val(1)
            //交管车辆类型
            // $("#car_kind").val('重型自卸货车')
            //   车辆类型
            // $("#car_leixing").val('十吨以上货车')
            //   号牌种类
            // $("#car_num_kind").val(0)
        }else if(value == '货车'){
            //号牌底色
            $("#haocolor").val(4)
            //使用性质
            $("#c-car_use_nature").val(1)
            //交管车辆类型
            // $("#car_kind").val('重型半挂牵引车')
            //   车辆类型
            // $("#car_leixing").val('十吨以上货车')
            //   号牌种类
            // $("#car_num_kind").val(0)
        }
        che_type(value)
        cc(value)
        gaibianff()
    })
    //查询出险信息
    function cc(value){
        var zuzhi_id=$("#yw_class").val()
        console.log('value',value)
        if(value == "挂车"){
            value = "货车"
        }
        console.log('value',value)
        $.ajax({
            type: 'post',
            url: "lists/one/select",//发送路径
            data: {
                zuzhi_id:zuzhi_id,
                type:value
            },//发送的数据
            dataType: 'json',
            async: false,//是否异步
            success: function (data) {
                var html='<option>请选择NCD</option>';
                console.log(data)
                for(var i = 0;i<data.data.length;i++){
                    html += '<option value="'+data.data[i].zhekou+','+data.data[i].ncd+','+data.data[i].feiyong+'">'+data.data[i].ncd+'</option>';
                }
                console.log(data.data)
                $("#ncd").html(html)
            }
        })
    }
    //ncd处理
    function che_type(value){
        var ywclass = $("#yw_class").find("option:selected").html();
        // 1.货车   2.自卸车  3.特二   4.2吨以下
        if(value=='货车'){
            var html=
                `<option>请选择NCD</option>
                <option value="60,新车,55">新车</option>
                <option value="50,0次,55" >0次</option>
                <option value="60,出险1次,55" >出险1次</option>
                <option value="77,出险2次,55" >出险2次</option>
                <option value="120,出险3次,55" >出险3次</option>
                <option value="150,出险3次以上,55" >出险3次以上</option>
                `
            $("#ncd").html(html)
        }else if(value == '自卸车'){
            var html=
                `<option>请选择NCD</option>
                <option value="60,新车,55" >新车</option>
                <option value="55,0次,55" >0次</option>
                <option value="65,出险1次,55" >出险1次</option>
                <option value="77,出险2次,55" >出险2次</option>
                <option value="120,出险3次,55" >出险3次</option>
                <option value="150,出险3次以上,55" >出险3次以上</option>
                `
            $("#ncd").html(html)
        }else if(value == '特二'){
            var html=
                `<option>请选择NCD</option>
                <option value="60,新车,55" >新车</option>
                <option value="70,0次,55" >0次</option>
                <option value="80,出险1次,55" >出险1次</option>
                <option value="100,出险2次,55" >出险2次</option>
                <option value="120,出险3次,55" >出险3次</option>
                <option value="150,出险3次以上,55" >出险3次以上</option>
                `
            $("#ncd").html(html)
        }else if(value == '2吨以下'){
            var html=
                `<option>请选择NCD</option>
                <option value="70,新车,55" >新车</option>
                <option value="70,0次,55" >0次</option>
                <option value="75,出险1次,55" >出险1次</option>
                <option value="90,出险2次,55" >出险2次</option>
                <option value="120,出险3次,55" >出险3次</option>
                `
            $("#ncd").html(html)
        }
        setTimeout(function(){
            var ncd=document.getElementById("ncd")
            ncd[2].selected=true
            var val=$("#ncd").val().split(",")
            var value=val[0]
            $("#chexing_ci").val(val[1])
            $("#feiyong").val(val[2])
            $("#addz").val(value)
            $("#main_sumdiscount").val(value)
            $('#kou').val(value);
            // oTi.innerHTML = dataname.value;

            // zi.innerHTML = dataname.value;
            $('#zi').val(100);
            // fa.innerHTML = dataname.value;
            $('#fa').val(value);
            // zhi.innerHTML = dataname.value;
            $('#zhi').val(value);
            // che.innerHTML = dataname.value;
            $('#che').val(value);
            // bo.innerHTML = dataname.value;
            $('#bo').val(value);
            // dao.innerHTML = dataname.value;
            // 			$('#dao').val(value);

            $('#dao').val(100);

            // siji.innerHTML = dataname.value;
            $('#siji').val(value);
            // cheng.innerHTML = dataname.value;
            $('#cheng').val(value);
            // san.innerHTML = dataname.value;
            $('#san').val(value);
            $('#sun').val(value);
        },500)
    }
    // 车辆类型改变方法
    $("#c-chexing").change(function(){
        console.log('///////',$("#c-chexing").val())
        var riqi=$("#c-car_register").val()
        if($("#c-chexing").val()=='二吨至五吨货车' || $("#c-chexing").val()=='五吨至十吨货车' || $("#c-chexing").val()=='十吨以上货车' || $("#c-chexing").val()=='挂车'){
            var leixing='货车'
        }else if($("#c-chexing").val() == '6座以下' || $("#c-chexing").val() == '6-10座'){
            var leixing='家庭自用车'
        }else if($("#c-chexing").val() == '预约出租客运'){
            var leixing='网约车'
        }else{
            var leixing=$("#c-chexing").val()
        }
        var car_buy=$("#c-car_buy").val()
        if(riqi!='' && leixing!='' && car_buy!=''){
            jisuan()
        }
    })
    function formatDate(value) {
        const date = new Date(value)
        const y = date.getFullYear()
        let MM = date.getMonth() + 1
        MM = MM < 10 ? ('0' + MM) : MM
        let d = date.getDate()
        d = d < 10 ? ('0' + d) : d
        let h = date.getHours()
        h = h < 10 ? ('0' + h) : h
        let m = date.getMinutes()
        m = m < 10 ? ('0' + m) : m
        let s = date.getSeconds()
        s = s < 10 ? ('0' + s) : s
        return y + '-' + MM + '-' + d
    }
    //计算信息
    $(function(){

        $('#c-car_register').on('input', function() {
            var riqi=$("#c-car_register").val()
            var date = formatDate(new Date())
            if(riqi > date){
                layer.alert('初登时间不能大于今天');
                return false
            }
            var leixing=$("#c-chexing").val()
            var car_buy=$("#c-car_buy").val()
            if(riqi!='' && leixing!='' && car_buy!=''){
                jisuan()
            }
        })
        $('#c-car_buy').on('input', function() {
            console.log(2333)
            var riqi=$("#c-car_register").val()

            var leixing=$("#c-chexing").val()
            var car_buy=$("#c-car_buy").val()
            if(riqi!='' && leixing!='' && car_buy!=''){
                jisuan()
            }
        })
    })
    //选择ncd后
    $("#ncd").change(function(){
        // var value=$(this).val()*100
        console.log('+++++++',$(this).val())
        var val=$(this).val().split(",")
        var value=val[0]
        $("#chexing_ci").val(val[1])
        $("#feiyong").val(val[2])
        $("#addz").val(value)
        $("#main_sumdiscount").val(value)
        $('#kou').val(value);
        // oTi.innerHTML = dataname.value;

        // zi.innerHTML = dataname.value;
        $('#zi').val(value);
        $('#dw').val(100);
        // fa.innerHTML = dataname.value;
        $('#fa').val(value);
        // zhi.innerHTML = dataname.value;
        $('#zhi').val(value);
        // che.innerHTML = dataname.value;
        $('#che').val(value);
        // bo.innerHTML = dataname.value;
        $('#bo').val(value);
        // dao.innerHTML = dataname.value;
        $('#dao').val(100);
        // siji.innerHTML = dataname.value;
        $('#siji').val(value);
        // cheng.innerHTML = dataname.value;
        $('#cheng').val(value);
        // san.innerHTML = dataname.value;
        $('#san').val(value);
        $('#sun').val(value);
    })
    /**
     * 控制表主服务是否全选
     * @type {HTMLElement}
     */
    var selectAll = document.getElementById('checks'); //获取全选元素
    var input = document.getElementsByClassName('chk'); //获取其他input元素
    var num = 0;
    //全选全不选的时候
    function isSelectALl(flag) {
        for (var i = 0; i < input.length; i++) {
            input[i].checked = flag;
        }
    }
    //点击全选
    selectAll.onclick = function() {
        if (selectAll.checked) {
            isSelectALl(true);
            num = input.length;
        } else {
            isSelectALl(false);
            num = 0;
        }
    }

    /**
     * 控制表副驾是否全选
     * @type {HTMLElement}
     */
    var select = document.getElementById('checkss'); //获取全选元素
    var inp = document.getElementsByClassName('chks'); //获取其他input元素
    var nums = 0;
    //全选全不选的时候
    function isSelect(flag) {
        for (var i = 0; i < inp.length; i++) {
            inp[i].checked = flag;
        }
    }
    //点击全选
    select.onclick = function() {
        if (select.checked) {
            isSelect(true);
            nums = inp.length;
        } else {
            isSelect(false);
            nums = 0;
        }
    }
</script>
<script>
    //获取当前选中值的文字
    var dataname = document.getElementById('addz');
    var oi = document.getElementById('kou');
    var zi = document.getElementById('zi');
    var fa = document.getElementById('fa');
    var zhi = document.getElementById('zhi');
    var che = document.getElementById('che');
    var bo = document.getElementById('bo');
    var dao = document.getElementById('dao');
    var siji = document.getElementById('siji');
    var cheng = document.getElementById('cheng');
    var san = document.getElementById('san');
    var sun = document.getElementById('sun');
    console.log(dataname)
    if ('oninput' in dataname) {
        dataname.addEventListener("change", getWord, false);

    } else {
        dataname.onpropertychange = getWord;
    }

    function getWord() {
        console.log('走到这了')
        if(Number(dataname.value) < Number($('#main_sumdiscount').val())){
            console.log('走到这了')

            layer.msg('折扣不可低于初始折扣')
            dataname.value = $('#main_sumdiscount').val()
            // return false;
        }
        $('#kou').val(dataname.value);
        // oTi.innerHTML = dataname.value;

        // zi.innerHTML = dataname.value;
        $('#zi').val(dataname.value);
        $('#dw').val(100);
        // fa.innerHTML = dataname.value;
        $('#fa').val(dataname.value);
        // zhi.innerHTML = dataname.value;
        $('#zhi').val(dataname.value);
        // che.innerHTML = dataname.value;
        $('#che').val(dataname.value);
        // bo.innerHTML = dataname.value;
        $('#bo').val(dataname.value);
        // dao.innerHTML = dataname.value;
        $('#dao').val(100);
        // siji.innerHTML = dataname.value;
        $('#siji').val(dataname.value);
        // cheng.innerHTML = dataname.value;
        $('#cheng').val(dataname.value);
        // san.innerHTML = dataname.value;
        $('#san').val(dataname.value);
        $('#sun').val(dataname.value);


    }
</script>
<script>
    // $(function(){
    //
    //     $("#main_santong").val(1000000)
    //     $("#siji_tong").val(10000)
    //     $("#ck").val(10000)
    //     $("#main_biao").val(3140.79)
    //     $("#siji_biao").val(30.45)
    //     $("#ck_biao").val(75.48)
    //     vs()
    //
    // })
    $(function(){
        console.log(22)
        $("#c-car_carry_peo").bind('input propertychange',function(){
            console.log(3434)
            vs()
        })
        $('#isnew').click(function() {
            if (document.getElementById("isnew").checked == true) {
                $('#isnew').val(1);
                $('#c-car_num').val('暂未上牌');
            } else {
                $('#isnew').val(2);
                $('#c-car_num').val('');
            }
        })
        //监听 --车上人员责任保险(乘客)元/座
        $("#ck").change(function() {
            vs();
        })
    })
    $("#dianwangs").change(function(){
        if($("#dianwangs").is(":checked")){
            $("#dw_tong").val($('#c-car_reall').val());
            $("#dw_biao").val(150)
            $("#dw").val(100)
            var z=numMulti($("#dw_biao").val(),$("#dw").val()/100)
            console.log(88888,z)
            $('#dw_ying').val(z);


        }else{
            $('#dw_ying').val('');
            $("#dw_biao").val('')

            $("#dw_tong").val('')
        }
        huobiaofei()
    })
    function vs() {
        console.log(1111)
        //     //损失服务 = 实际价值
        //     //  实际价值

        var car_reall = document.getElementById('c-car_reall').value;
        var he = document.getElementById('c-car_carry_peo').value;
        if (he == '') {
            $('#zuo').val('');
        } else {
            var zai = he - 1;
            console.log('zai',zai)
            $('#zuo').val(zai);
        }
        //第一行
        let yic = document.getElementById('main_name').checked;
        if (yic) {

            $('#main_money').val($('#c-car_reall').val());
        }else{
            $('#main_money').val('');
        }
        // 外部电网
        let dw_cc = document.getElementById('dianwangs').checked;
        if (dw_cc) {
            console.log(12121212)

            $('#dw_tong').val($('#c-car_reall').val());
            $("#dw_biao").val(150)
            $("#dw").val(100)
            var z=numMulti($("#dw_biao").val(),$("#dw").val()/100)
            console.log(333312121212,z)
            $('#dw_ying').val(z);
        } else {
            $('#dw_tong').val('');
            $('#dw_ying').val('');
        }
        // 乘客算法
        //获取填入金钱数量
        var yuan = document.getElementById('ck').value;
        //alert(yuan);

        //服务金额获取
        // var ck_tong = document.getElementById('ck_tong').value;
        var ck_tong = zai * yuan;
        // console.log(ck_tong);
        if (isNaN(ck_tong)) {
            $('#ck_tong').val('');
        } else {
            $('#ck_tong').val(ck_tong);
        }
    }
</script>
<script>
    function accMul(arg1,arg2) {
        var m=0,s1=arg1.toString(),s2=arg2.toString();
        try{m+=s1.split(".")[1].length}catch(e){}
        try{m+=s2.split(".")[1].length}catch(e){}
        return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m)
    }
    // 			加法
    function numAdd(num1, num2) {
        var baseNum, baseNum1, baseNum2;
        try {
            baseNum1 = num1.toString().split(".")[1].length;
        }catch (e) {
            baseNum1 = 0;
        }try {
            baseNum2 = num2.toString().split(".")[1].length;
        }catch (e) {
            baseNum2 = 0;
        }baseNum = Math.pow(10, Math.max(baseNum1, baseNum2));
        return (num1 * baseNum + num2 * baseNum) / baseNum;
    };


    /**
     * 对选中的相应数据赋值
     */
    var zhekou = 0.15;
    var zhekous = 0.20;
    //机动车损失筹
    let jidongche = getVals('main_standard', zhekou, 'main_franchise', 'main_submit', 'main_name');

    //机动车第三者责任服务
    let disnazhe = getVals('main_biao', zhekou, 'main_ji', 'main_yingjiao', 'main_disan');

    // 机动车全车盗抢服务
    let daoqiang = getVals('dao_biao', zhekous, 'dao_ji', 'dao_ying', 'dao_name');

    //车上人员责任服务(司机)
    let siji_tong = getVals('siji_biao', zhekou, 'siji_ji', 'siji_ying', 'si_jis');

    //车上人员责任保险(乘客)
    let chengke_tong = getVals('ck_biao', zhekou, 'ck_ji', 'ck_ying', 'chengkess');


    //自燃损失服务
    // let ziran_sun = getVals('zi_biao', zhekous, 'zi_buji', 'zi_ying', 'zirans');

    //发动机涉水损失服务
    // let fadongji = getVals('fdj_biao', '', 'fdj_buji', 'fdj_ying', 'fadongji');

    //指定修理厂服务
    // let zhiding = getVals('zd_biao', '', 'zd_buji', 'zd_ying', 'xiuli');

    //车上货物责任服务
    // let huowu = getVals('hw_biao', '', 'hw_buji', 'hw_ying', 'huowu');

    //玻璃单独破碎服务
    // let boli = getVals('bl_biao', '', 'bl_buji', 'bl_ying', 'boli');
    //获取标费
    $("#biaofei").click(function(){
        huobiaofei()

    })

    $("#main_santong").change(function(){
        let erc = document.getElementById('main_disan').checked;

        console.log(111)
        if(erc){
            console.log(111)
            huobiaofei()
        }
    })
    $("#siji_tong").change(function(){
        let erc = document.getElementById('si_jis').checked;
        if(erc){
            console.log(111)
            huobiaofei()
        }
    })
    $("#ck").change(function(){
        let erc = document.getElementById('chengkess').checked;
        if(erc){
            console.log(111)
            huobiaofei()
        }
    })
    // $("#dao_tong").change(function(){
    //     let erc = document.getElementById('dao_name').checked;
    //     if(erc){
    //         console.log(111)
    //         huobiaofei()
    //     }
    // })
    $("#dao_tong").on("change",function(){
        var xx=document.getElementById('dao_name').checked
        if(xx){
            console.log($(this).val())

            var value=$(this).val()
            if(value=='50000'){
                $("#dao_biao").val(150)
            }
            if(value == '100000'){
                $("#dao_biao").val(300)
            }
            var zhekou1=$("#dao").val()
            var zhekou2=numDiv(zhekou1,100)
            var zhi=numMulti(zhekou2, $("#dao_biao").val())
            $("#dao_ying").val(zhi.toFixed(2))
            huobiaofei()
        }

    })
    $("#zirans").change(function(){
        huobiaofei()
    })
    $("#checks").change(function(){
        huobiaofei()
    })
    $("#main_name").change(function(){
        // console.log('---------')
        huobiaofei()
    })
    $("#main_disan").change(function(){
        huobiaofei()
    })
    $("#si_jis").change(function(){
        huobiaofei()
    })
    $("#chengkess").change(function(){
        huobiaofei()
    })
    $("#dao_name").change(function(){
        var value=$('#dao_tong').val()
        console.log('yibao',value)
        if(value=='50000'){
            $("#dao_biao").val(150)
        }
        if(value == '100000'){
            $("#dao_biao").val(300)
        }
        var zhekou1=$("#dao").val()
        var zhekou2=numDiv(zhekou1,100)
        var zhi=numMulti(zhekou2, $("#dao_biao").val())
        $("#dao_ying").val(zhi.toFixed(2))
        huobiaofei()
    })


    // 		获取标费方法
    function huobiaofei(){
        //车辆类型1
        if($("#c-chexing").val()=='二吨至五吨货车' || $("#c-chexing").val()=='五吨至十吨货车' || $("#c-chexing").val()=='十吨以上货车'){
            var cartype='货车'
        }else if($("#c-chexing").val() == '6座以下' || $("#c-chexing").val() == '6-10座'){
            var cartype='家庭自用车'
        }else if($("#c-chexing").val() == '预约出租客运'){
            var cartype='网约车'
        }else{
            var cartype=$("#c-chexing").val()
        }
        // var cartype=$("#cartype").val()
        //载客
        var zaike=$("#c-car_carry_peo").val()
        // 车辆类型2
        var cartype2=$("#c-car_leixing").val()


        var san = [];
        var siji = [];
        var cheng = [];
        //新加的东西开始
        sf = 0.035;

        $.ajax({
            type: 'get',
            url: "/api/index/bili", //发送路径
            data: {
                cartype: cartype,
                cartype2:cartype2

            }, //发送的数据
            //   dataType: 'json',
            async: false, //是否异步
            success: function (res) {
                sf = res.data
            }
        })
        console.log(sf,222)
        // if($("#yelai").find("option:selected").val()=='电销业务'){
        if($("#c-car_reall").val()==''){
            layer.alert('请填写实际价值')
        }else{
            var jiazhi=Number($("#c-car_reall").val())
            var value=accMul(jiazhi,sf)
            console.log(value,7777)
            value = numAdd(value,0)
            if($("#main_name").is(":checked")){
                $("#main_standard").val(value.toFixed(2))
            }else{
                $("#main_standard").val('')
            }
            var Yous = $('#addz');
            //计算应缴服务费开始s
            let getFoolat = $("#main_standard").val() * (Yous.val() / 100);
            $("#main_submit").val(getFoolat.toFixed(2))
            $('#main_money').val($('#c-car_reall').val());


        }
        //新加的东西结束

        if($("#main_disan").is(":checked")){
            if($("#main_santong").val()==''){
                //alert('请选择机动车第三者责任服务金额')
                //return false;
            }
            var sz=$("#main_santong").val()

        }else{
            var sz=''
        }
        if($("#si_jis").is(":checked")){
            if($("#siji_tong").val()==''){
                //alert('请选择车上人员责任服务金额')
                //return false;
            }
            var sj=$("#siji_tong").val()

        }else{
            var sj=''
        }
        if($("#chengkess").is(":checked")){
            if($("#ck").val()==''){
                //alert('请选择车上人员责任服务(乘客)')
                //return false;
            }
            var ck=$("#ck").val()
            var zuowei=$("#zuo").val()

        }else{
            var ck=''
            var zuowei=''
        }
        console.log(sz)
        console.log(sj)
        console.log(ck,zuowei)
        san['wan'] = sz;
        siji['wan'] = sj;
        cheng['wan'] = ck;
        cheng['num'] = zuowei;
        // if($("#dao_name").is(":checked")){
        //     $("#dao_biao").val('300')
        //     $("#dao_ying").val('300')
        //     //vs()
        // }
        if($("#dianwangs").is(":checked")){
            $("#dw_biao").val(150)
            $("#dw").val(100)
            var z=numMulti($("#dw_biao").val(),$("#dw").val()/100)
            console.log(333312121212,z)
            $('#dw_ying').val(z);

        }
        //return false;
        $.ajax({
            type: 'post',
            url: "/api/index/biao", //发送路径
            data: {
                chexing:cartype,
                car_leixing:cartype2,
                san:{'wan':sz},
                siji:{'wan':sj},
                cheng:{'wan':ck,'num':zuowei},
                // car_leixing:zaike

            }, //发送的数据
            //                    dataType: 'json',
            async: false, //是否异步
            success: function(data) {
                console.log(data)
                var value=data.data
                if(value.cheng!=0){
                    $("#ck_biao").val(value.cheng)
                    $("#ck_biao1").val(value.cheng)
                    //乘客应交服务费
                    var ying3=$("#ck_biao").val() * ($("#cheng").val()/100)
                    $("#ck_ying").val(ying3.toFixed(2))
                }
                if(value.san!=0){
                    $("#main_biao").val(value.san)
                    $("#main_biao1").val(value.san)
                    //第三者应交服务费
                    var ying1=$("#main_biao").val()*($("#san").val()/100)
                    $("#main_yingjiao").val(ying1.toFixed(2))
                }
                if(value.siji!=0){
                    $("#siji_biao").val(value.siji)
                    $("#siji_biao1").val(value.siji)
                    //司机应交服务费
                    var ying2=$("#siji_biao").val() * ($("#siji").val()/100)
                    $("#siji_ying").val(ying2.toFixed(2))
                }else if(value.siji==''){
                    $("#siji_biao").val('')
                    $("#siji_biao1").val('')
                }
                var IsCk = document.getElementById('main_franchise').checked;

                var jiche1;
                if (IsCk) {
                    jiche1 = Number($('#main_standard').val());
                } else {
                    jiche1 = 0;
                }
                var IsA = document.getElementById('main_ji').checked;
                var sanzhe;
                if (IsA) {
                    sanzhe = Number($('#main_biao').val());
                } else {
                    sanzhe = 0;
                }
                var IsB = document.getElementById('dao_ji').checked;
                var jidao;
                if (IsB) {
                    jidao = Number($('#dao_biao').val());
                    console.log(jidao)
                } else {
                    jidao = 0;
                }
                var IsC = document.getElementById('siji_ji').checked;
                var chesi;
                if (IsC) {
                    chesi = Number($('#siji_biao').val());
                } else {
                    chesi = 0;
                }
                var IsD = document.getElementById('ck_ji').checked;
                var cheke;
                if (IsD) {
                    cheke = Number($('#ck_biao').val());
                } else {
                    cheke = 0;
                }
                // var IsE = document.getElementById('zi_buji').checked;
                // var zichou;
                // if (IsE) {
                //     zichou = Number($('#zi_biao').val());
                // } else {
                zichou = 0;
                // }
                //不参与计算的值

                var NoMAins = ((jiche1 + sanzhe + chesi + cheke) * 0.15) + (jidao * 0.20) + (zichou * 0.20);
                $('.NoMAins').val(NoMAins.toFixed(2))
                //不计免赔标准统计费计算结束-------author:liu

                //不计免赔应缴服务费计算开始
                var tttt = $('#addz').val()
                var bu_ying = NoMAins * (tttt / 100);
                $('#bu_ying').val(bu_ying.toFixed(2))
                //不计免赔应缴服务费计算结束-------author：liu

                //基准服务费（合计）
                var inputs = $('.zongshu'); //找到div里面所有的input
                var zpp = 0;
                for (var o = 0; o < inputs.length; o++) {
                    zpp += +inputs[o].value
                }
                // var jq_price=$("#jq_price").val()//交强税
                //             var cc_price=$("#cc_price").val()//车船税
                //             var he2=numAdd(jq_price,cc_price)
                //             var zonghee1=numAdd(zpp,he2)

                // $('#main_sum').val(zonghee1.toFixed(2));
                console.log('标准服务费',zpp.toFixed(2))
                $('#main_sum').val(zpp.toFixed(2));

                //总服务费（合计）
                var zong_tongchou = $('.zong_tongchou'); //找到div里面所有的input
                var ztc = 0;
                for (var i = 0; i < zong_tongchou.length; i++) {
                    console.log('服务费1',Number(zong_tongchou[i].value))
                    ztc += +Number(zong_tongchou[i].value);
                }
                // var bu_yingg=$('#bu_ying').val()
                var bu_yingg=0
                var he=numAdd(ztc,bu_yingg)
                // var jq_price=$("#jq_price").val()//交强税
                // var cc_price=$("#cc_price").val()//车船税
                // var he2=numAdd(jq_price,cc_price)
                // var zonghee=numAdd(he,he2)

                console.log('服务费2',he.toFixed(2))
                $('#main_free').val(he.toFixed(2));

            }})
    }
    /**
     *
     * @param a  名字 返回的名字
     * @param b  折扣
     * @param c  复选框
     * @param d 应缴服务
     * @param e 是否选中该条数据
     */
    function getVals(a, zhekou, c, d, e) {
        document.getElementById('addz').addEventListener('change', function(event) {
            var inputValue = this.value; // 获取输入框的值//keyup
            console.log('inputValue',inputValue)
            console.log('之前',$('#main_sumdiscount').val())
            if(Number(inputValue) < Number($('#main_sumdiscount').val())){
                layer.msg('折扣不可低于初始折扣')
                $('#addz').val($('#main_sumdiscount').val())
                return false;
            }


        })
        var ds = $("#" + d);
        return jisuan2(a, zhekou, c, ds, e);
    }

    function jisuan2(name, zhekou, btns, main_submit, isselect) {
        let names = $("#" + name);
        let btn = document.getElementById(btns);
        let isck = document.getElementById(isselect);

        function numsInfo(vasTo = '', valPutchis = '') {
            console.log(22222)
            console.log(zhekou)
            console.log($('#dao_ying').val())
            // var IsCk = document.getElementById(btns).checked;
            // //不计免赔标准统计费计算开始
            // var jiche1;
            //     if(IsCk){
            //         jiche1 =vals($('#main_standard'))?vals($('#main_standard')):0;
            //     }else{
            //         jiche1 = 0;
            //     }
            //     console.log(jiche1)
            //
            //
            // var sanzhe = Number($('#main_biao').val())?Number($('#main_biao').val()):0;
            // var jidao = Number($('#dao_biao').val())?Number($('#dao_biao').val()):0;
            // var chesi = Number($('#siji_biao').val())?Number($('#siji_biao').val()):0;
            // var cheke = Number($('#ck_biao').val())?Number($('#ck_biao').val()):0;
            // var zichou =Number($('#zi_biao').val())?Number($('#zi_biao').val()):0;
            //  第一行是否选中
            let yic = document.getElementById('main_name').checked;
            if (!yic) {

                $('#main_standard').val('');
                $('#main_submit').val('');
                $('#main_money').val('');
            }else{

                $('#main_money').val($('#c-car_reall').val());
            }
            //第二行是否选中
            let erc = document.getElementById('main_disan').checked;
            if (erc) {} else {
                $('#main_santong').val('');
                $('#main_biao').val('');
                $("#main_biao1").val('');

                $('#main_yingjiao').val('');
            }
            //第三行是否选中
            let sanc = document.getElementById('dao_name').checked;
            if (sanc) {
                $("#dao").val(100)
            } else {
                $('#dao_tong').val('');
                $('#dao_biao').val('');
                $('#dao_ying').val('');
            }

            //第四行是否选中
            let sic = document.getElementById('si_jis').checked;
            if (sic) {

            } else {
                console.log('+++++++++')
                $('#siji_tong').val('');
                $('#siji_biao').val('');
                $('#siji_biao1').val('');

                $('#siji_ying').val('');
            }

            //第五行是否选中
            let wuc = document.getElementById('chengkess').checked;
            if (wuc) {

            } else {
                $('#ck_tong').val('');
                $('#ck_biao').val('');
                $('#ck_biao1').val('');
                $('#ck_ying').val('');
                $('#ck').val('');
            }

            // 外部电网
            let dw_cc = document.getElementById('dianwangs').checked;
            if (dw_cc) {
                console.log(12121212)
                // 	$('#dw_tong').val('');
                $('#dw_tong').val($('#c-car_reall').val());
                $("#dw_biao").val(150)
                $("#dw").val(100)
                var z=numMulti($("#dw_biao").val(),$("#dw").val()/100)
                console.log(333312121212,z)
                $('#dw_ying').val(z);
            } else {
                $('#dw_tong').val('');
                $('#dw_ying').val('');
            }
            //第六行是否选中
            // let liuc = document.getElementById('zirans').checked;
            // if (liuc) {
            //     $('#zi_tong').val($('#car_reall').val());
            //
            //
            //
            //
            // } else {
            //     $('#zi_tong').val('');
            //     $('#zi_biao').val('');
            //     $('#zi_ying').val('');
            // }
            //
            // //第七行是否选中
            // let qic = document.getElementById('fadongji').checked;
            // if (qic) {
            //     $('#fdj_tong').val($('#car_reall').val());
            // } else {
            //     $('#fdj_tong').val('');
            //     $('#fdj_biao').val('');
            //     $('#fdj_ying').val('');
            // }
            //
            // //第八行是否选中
            // let bac = document.getElementById('xiuli').checked;
            // if (bac) {
            //
            // } else {
            //     $('#zd_tong').val('');
            //     $('#zd_biao').val('');
            //     $('#zd_ying').val('');
            // }
            //
            // //第九行是否选中
            // let jiuc = document.getElementById('huowu').checked;
            // if (jiuc) {
            //
            // } else {
            //     $('#hw_tong').val('');
            //     $('#hw_biao').val('');
            //     $('#hw_ying').val('');
            // }
            //
            //
            // //第十行是否选中
            // let shic = document.getElementById('boli').checked;
            // if (shic) {
            //
            // } else {
            //     $('#bl_tong').val('');
            //     $('#bl_biao').val('');
            //     $('#bl_ying').val('');
            // }
            var IsCk = document.getElementById('main_franchise').checked;

            var jiche1;
            if (IsCk) {
                jiche1 = Number($('#main_standard').val());
            } else {
                jiche1 = 0;
            }
            var IsA = document.getElementById('main_ji').checked;
            var sanzhe;
            if (IsA) {
                sanzhe = Number($('#main_biao').val());
            } else {
                sanzhe = 0;
            }
            var IsB = document.getElementById('dao_ji').checked;
            var jidao;
            if (IsB) {
                jidao = Number($('#dao_biao').val());
                console.log(jidao)
            } else {
                jidao = 0;
            }
            var IsC = document.getElementById('siji_ji').checked;
            var chesi;
            if (IsC) {
                chesi = Number($('#siji_biao').val());
            } else {
                chesi = 0;
            }
            var IsD = document.getElementById('ck_ji').checked;
            var cheke;
            if (IsD) {
                cheke = Number($('#ck_biao').val());
            } else {
                cheke = 0;
            }
            // var IsE = document.getElementById('zi_buji').checked;
            // var zichou;
            // if (IsE) {
            //     zichou = Number($('#zi_biao').val());
            // } else {
            zichou = 0;
            // }
            //不参与计算的值

            var NoMAins = ((jiche1 + sanzhe + chesi + cheke) * 0.15) + (jidao * 0.20) + (zichou * 0.20);
            $('.NoMAins').val(NoMAins.toFixed(2))
            //不计免赔标准统计费计算结束-------author:liu


            if(name=='dao_biao'){
                var Yous = $("#dao")
            }else{
                var Yous = $('#addz');
            }

            //计算应缴服务费开始s
            let getFoolat = names.val() * (Yous.val() / 100);
            main_submit.val(getFoolat.toFixed(2))
            //计算应缴服务费结束 ----author:Liu

            //不计免赔应缴服务费计算开始
            var tttt = $('#addz').val()
            var bu_ying = NoMAins * (tttt / 100);
            $('#bu_ying').val(bu_ying.toFixed(2))
            //不计免赔应缴服务费计算结束-------author：liu

            //基准服务费（合计）
            var inputs = $('.zongshu'); //找到div里面所有的input
            var zpp = 0;
            for (var o = 0; o < inputs.length; o++) {
                zpp += +inputs[o].value
            }
            // var jq_price=$("#jq_price").val()//交强税
            //             var cc_price=$("#cc_price").val()//车船税
            //             var he2=numAdd(jq_price,cc_price)
            //             var zonghee1=numAdd(zpp,he2)

            // $('#main_sum').val(zonghee1.toFixed(2));

            $('#main_sum').val(zpp.toFixed(2));

            //总服务费（合计）
            var zong_tongchou = $('.zong_tongchou'); //找到div里面所有的input
            var ztc = 0;
            for (var i = 0; i < zong_tongchou.length; i++) {
                ztc += +Number(zong_tongchou[i].value);
            }
            // var bu_yingg=$('#bu_ying').val()
            var bu_yingg=0
            var he=numAdd(ztc,bu_yingg)

            // var jq_price=$("#jq_price").val()//交强税
            // var cc_price=$("#cc_price").val()//车船税
            // var he2=numAdd(jq_price,cc_price)
            // var zonghee=numAdd(he,he2)
            // $('#main_free').val(zonghee.toFixed(2));
            console.log('服务费3',he)
            $('#main_free').val(he.toFixed(2));

        }
        document.getElementById(name).addEventListener('change', function(event) {
            var inputValue = this.value; // 获取输入框的值//keyup
            var newvalue = 0
            if(name == 'ck_biao'){
                newvalue = $('#ck_biao1').val()
            }else if(name == 'siji_biao'){
                newvalue = $('#siji_biao1').val()
            }else if(name == 'main_biao'){
                newvalue = $('#main_biao1').val()
            }
            if(Number(inputValue) < Number(newvalue)){
                layer.msg('不可低于初始服务费')
                $("#"+name).val(newvalue)
            }
            var IsCk = document.getElementById(isselect).checked;

            if (IsCk) {
                numsInfo(name, isselect)
            } else {
                numsInfo(name, isselect)
                return false;
            }
            var Is = document.getElementById(btns).checked;

            if (Is) {
                numsInfo(name, btns)
            } else {
                numsInfo(name, btns)
                return false;
            }

        })
        document.getElementById('ncd').addEventListener('change', function(event) {
            var IsCk = document.getElementById(isselect).checked;

            if (IsCk) {
                numsInfo(name, isselect)
            } else {
                numsInfo(name, isselect)
                return false;
            }
            var Is = document.getElementById(btns).checked;

            if (Is) {
                numsInfo(name, btns)
            } else {
                numsInfo(name, btns)
                return false;
            }
        })
        document.getElementById('addz').addEventListener('change', function(event) {
            var inputValue = this.value; // 获取输入框的值//keyup
            console.log('inputValue',inputValue)
            console.log('之前',$('#main_sumdiscount').val())
            if(Number(inputValue) < Number($('#main_sumdiscount').val())){
                layer.msg('折扣不可低于初始折扣')
                return false;
            }
            var IsCk = document.getElementById(isselect).checked;

            if (IsCk) {
                numsInfo(name, isselect)
            } else {
                numsInfo(name, isselect)
                return false;
            }
            var Is = document.getElementById(btns).checked;

            if (Is) {
                numsInfo(name, btns)
            } else {
                numsInfo(name, btns)
                return false;
            }

        })
        //判断勾选状态
        document.getElementById(isselect).addEventListener('click', function() {
            var isTrue = document.getElementById(isselect).checked;
            if (isTrue) {
                numsInfo(name);
            } else {
                numsInfo(name);
                return false;

            }
        });
        //判断勾选状态
        document.getElementById(btns).addEventListener('click', function() {
            var isTrue = document.getElementById(btns).checked;
            if (isTrue) {
                numsInfo(name);
            } else {
                numsInfo(name);
                return false;
            }
        });
    }

    function vals(id) {
        return Number(id.val());
    }

    function isChex(id) {
        if (document.getElementById(id).checked == true) {
            id = '选中';
        } else {
            id = 0;
        }
        return id;
    }

    // 		监听车辆类型改变方法渲染服务项目的值
    $("#c-chexing").change(function(){
        console.log('++++++',$("#c-chexing").val())

        if($("#c-chexing").val()=='二吨至五吨货车' || $("#c-chexing").val()=='五吨至十吨货车' || $("#c-chexing").val()=='十吨以上货车' || $("#c-chexing").val()=='挂车'){
            var leixing1='货车'
        }else if($("c-chexing").val() == '6座以下' || $("#c-chexing").val() == '6-10座'){
            var leixing1='家庭自用车'
        }else if($("#c-chexing").val() == '预约出租客运'){
            var leixing1='网约车'
        }else{
            var leixing1=$("#c-chexing").val()
        }
        console.log('leixing1',leixing1)
        var leixing2=$("#c-car_leixing").val()
        console.log('leixing2',leixing2)

        fuzhi(leixing1,leixing2)
    })
    $("#c-car_leixing").change(function(){

        if($("#c-chexing").val()=='二吨至五吨货车' || $("#c-chexing").val()=='五吨至十吨货车' || $("#c-chexing").val()=='十吨以上货车' || $("#c-chexing").val()=='挂车'){
            var leixing1='货车'
        }else if($("#c-chexing").val() == '6座以下' || $("#c-chexing").val() == '6-10座'){
            var leixing1='家庭自用车'
        }else if($("#c-chexing").val() == '预约出租客运'){
            var leixing1='网约车'
        }else{
            var leixing1=$("#c-chexing").val()
        }
        var leixing2=$("#c-car_leixing").val()
        fuzhi(leixing1,leixing2)
    })
    // 判断选择的值的方法
    function fuzhi(leixing1,leixing2){
        if(leixing1=='2吨以下'){
            $("#main_biao").val(3656.59)
            $("#main_biao1").val(3656.59)
            $("#siji_biao").val(74.91)
            $("#siji_biao1").val(74.91)
            $("#ck_biao").val(66.24)
            $("#ck_biao1").val(66.24)
        }
        if(leixing1=='特二'){
            $("#main_biao").val(5135.43)
            $("#main_biao1").val(5135.43)
            $("#siji_biao").val(45.45)
            $("#ck_biao").val(28.29)
            $("#siji_biao1").val(45.45)
            $("#ck_biao1").val(28.29)
        }
        if(leixing1=='网约车'){
            $("#main_biao").val(3140.79)
            $("#main_biao1").val(3140.79)
            $("#siji_biao").val(34.51)
            $("#ck_biao").val(21.39)
            $("#siji_biao1").val(34.51)
            $("#ck_biao1").val(21.39)
        }
        if(leixing1=='货车' || leixing1=='自卸车' ){
            if(leixing2=='十吨以上货车'){
                $("#main_biao").val(10068.67)
                $("#main_biao1").val(10068.67)
                $("#siji_biao").val(74.91)
                $("#ck_biao").val(66.24)
                $("#siji_biao1").val(74.91)
                $("#ck_biao1").val(66.24)
            }
            if(leixing2=='五吨至十吨货车'){
                $("#main_biao").val(6052.84)
                $("#main_biao1").val(6052.84)
                $("#siji_biao").val(74.91)
                $("#ck_biao").val(33.12)
                $("#siji_biao1").val(74.91)
                $("#ck_biao1").val(33.12)
            }
            if(leixing2=='二吨至五吨货车'){
                $("#main_biao").val(4600.33)
                $("#main_biao1").val(4600.33)
                $("#siji_biao").val(74.91)
                $("#ck_biao").val(33.12)
                $("#siji_biao1").val(74.91)
                $("#ck_biao1").val(33.12)
            }
        }
    }
</script>
<script>
    //车主信息同被服务人操作
    $('#cbrcz').click(function() {
        if (document.getElementById("cbrcz").checked == true) {
            var learned_name = document.getElementById("c-learned_name");
            var learned_num = document.getElementById("c-learned_num");
            var learned_phone = document.getElementById("c-learned_phone");
            var aa = $("#c-learned_kind").find("option:selected").val();
            $("#c-car_card_kind").val(aa);
            $('#c-car_owner').val(learned_name.value);
            $('#c-car_card').val(learned_num.value);
        } else {
            $("#c-car_card_kind").val(0);
            $('#c-car_owner').val('');
            $('#c-car_card').val('');
        }
    })
    $('#tcz').click(function() {
        if (document.getElementById("tcz").checked == true) {
            var chezhu = document.getElementById("c-car_owner");
            var car_card = document.getElementById("c-car_card");
            var aa = $("#c-car_card_kind").find("option:selected").val();
            $("#c-learned_kind").val(aa);
            $('#c-learned_name').val(chezhu.value);
            $('#c-learned_num').val(car_card.value);
        } else {
            $('#c-learned_name').val('');
            $('#c-learned_num').val('');
            $("#c-learned_kind").val(0);
        }
    })
</script>
<script>
    //提交审核
    function ajaxPost() {
        if (!handle_from(0)) {
            return false;
        }
        //提交数据
        var formData = $("#add-form").serialize();
        console.log(formData);
        $.ajax({
            type:"post",
            dataType:'json',
            url:"lists/one/add?status=1",
            data:formData,
            success:function(res){
                console.log(res);
                if (res.code == 1) {
                    layer.msg('提交成功',{time:2000},function(){
                        layer.closeAll()
                        parent.layer.closeAll();
                        parent.$("#table").bootstrapTable('refresh', {});
                    });
                } else {
                    layer.msg(res.msg);
                }
            }
        });
    }
    function handle_from(status) {
        if($("#c-chexing").val()==''){
            layer.msg('请选择车辆类型');
            return false;
        }
        try {
            handle_text('c-car_owner', null, '车主姓名 不能为空');
            if(status == 0){
                handle_text('c-learned_phone', null, '手机号 不能为空');
            }
            handle_text('c-car_card', null, '证件号 不能为空');
            if ($('#c-car_card_kind').val() == '0') {
                if (!/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test($('#c-car_card').val())) {
                    layer.msg('证件号格式不对!!');
                    $('#c-car_card').focus();
                    return false;
                }
            }
            if ($('#c-learned_kind').val() == '0') {
                if (!/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test($('#c-learned_num').val())) {
                    layer.msg('证件号格式不对!!');
                    $('#c-learned_num').focus();
                    return false;
                }
            }
            handle_text('c-learned_name', null, '被服务人姓名 不能为空');
            handle_text('c-learned_num', null, '被服务人证件号 不能为空');
            handle_text('c-car_num', null, '车牌照号 不能为空');
            handle_text('c-car_vin', null, '车架号 不能为空');
            handle_text('c-car_engine', null, '发动机号 不能为空');
            handle_text('c-car_factory_num', null, '厂牌型号 不能为空');
            handle_text('c-car_register', test_date, '请填写正确 初登时间');
            handle_text('c-car_carry_peo', v => /\d+/.test(v), '请填写正确 核定载客');
            handle_text('c-car_carry_quality', v => /\d+/.test(v), '请填写正确 核定载质量');
            handle_text('ncd', null, '上年出险情况 不能为空');
            handle_text('yw_class', null, '归属部门 不能为空');
            handle_text('yw_come', null, '业务来源 不能为空');

            return true;
        } catch (e) {
            return false;
        }
    }
    function handle_text(id, reg, msg) {
        var dom = $('#' + id);
        var v = dom.val();
        console.log(id, v);
        if (v && (!reg || reg(v)))
            return true;
        layer.msg(msg);
        dom.focus();
        throw new Error(msg);
    }
    function test_date(v) {
        return /20\d{2}-(0\d|1[012])-[0-3][0-9]/.test(v);
    }
    //暂存功能
    function zancuns() {
        if (!handle_from(1)) {
            return false;
        }
        //提交数据
        // saveImage();
        var formData = $("#add-form").serialize();
        console.log(formData);
        $.ajax({
            type: "post",
            dataType: 'json',
            url: "lists/one/add?status=2",
            data: formData,
            success: function (res) {
                console.log(res);
                if (res.code == 1) {
                    layer.msg('提交成功',{time:2000},function(){
                        layer.closeAll()
                        parent.layer.closeAll();
                        parent.$("#table").bootstrapTable('refresh', {});
                        var url = "lists/one/baojiadan_new?id="+res.data.id;
                        // Fast.api.redirect("lists/one/baojiadan_new?id="+res.data.id,'报价单');
                        Backend.api.addtabs1(url, '报价单')
                    });
                } else {
                    layer.msg(res.msg);
                }
            }
        });
    }
    //第一页面的下一步
    $('.tab-label1').click(function() {
        // 移除所有标签的激活状态和内容的显示状态
        $('.tab-label, .tab').removeClass('active');
        // 添加激活状态到点击的标签和对应的内容
        $('#tab2').addClass('active');
        $('#tab22').addClass('active');
    });
    //第二页面的下一步
    $('.tab-label2').click(function() {
        // 移除所有标签的激活状态和内容的显示状态
        $('.tab-label, .tab').removeClass('active');
        // 添加激活状态到点击的标签和对应的内容
        $('#tab4').addClass('active');
        $('#tab44').addClass('active');
    });

</script>
<script>
    //查询被服务人
    $('#c-learned_name').blur(function() {
        var learned_name = $('#c-learned_name').val();
        if (learned_name == '') {
            layer.msg('被服务人姓名不能为空！', {
                time: 1000
            });
            return false;
        }
        $.ajax({
            type: 'post',
            url: "{:url('lists/one/learned_info')}",
            data: {
                learned_name: learned_name
            },
            success: function(data) {
                if (data.status == '1') {
                    layer.confirm('此客户已存在，是否导入数据！', {
                        btn: ['确定', '取消'], //按钮
                        shade: false //不显示遮罩
                    }, function(index) {
                        ifranmek("{:url('lists/one/learned_list')}?learned_name=" +
                            learned_name, '被服务人');
                        layer.close(index);
                    })
                } else {
                    layer.msg('暂无客户信息！', {
                        time: 1000
                    });
                }
            }
        })
    })
    //参统人iframe框架
    function ifranmek(url, title) {
        layer.open({
            type: 2,
            title: title,
            maxmin: true,
            area: ['1000px', '800px'],
            content: url,
        });
    }
    //查询号码
    $('#c-car_num').blur(function() {

        if ($('#isnew').is(':checked')) {
            console.log('新车');
        } else {
            var car_num = $('#c-car_num').val();
            if (car_num == '') {
                layer.msg('号码号牌不能为空！', {
                    time: 1000
                });
                return false;
            }
            $.ajax({
                type: 'post',
                url: "{:url('lists/one/car_num_info')}",
                data: {
                    car_num: car_num
                },
                success: function(data) {
                    if (data.status == '1') {
                        layer.confirm('此车辆存在，是否导入数据！', {
                            btn: ['确定', '取消'], //按钮
                            shade: false //不显示遮罩
                        }, function(index) {
                            ifranmek("{:url('lists/one/car_num_list')}?car_num=" +
                                car_num, '车辆信息');
                            layer.close(index);
                        })
                    } else {
                        layer.msg(data.msg, {
                            time: 1000
                        });
                    }
                }
            })

        }

    })
    // 全部搜索
    $("#quan_sou").on("click",function(){
        console.log(1212)
        var aa=$("#sou_val").val()
        if(aa==''){
            layer.alert("请输入内容")
            return false;
        }
        $.ajax({
            type: 'get',
            url: "/api/index/down_search", //发送路径
            data: {
                title:aa

            }, //发送的数据
            //   dataType: 'json',
            async: false, //是否异步
            success: function(res) {
                console.log(res)
                if(res.code==1){
                    if(res.renew.length != 0){
                        layer.confirm('此保单已存在，是否续保！', {
                            btn: ['确定', '取消'], //按钮
                            shade: false //不显示遮罩
                        }, function(index) {
                            layer.close(index);
                            layer.closeAll()
                            parent.layer.closeAll();
                            parent.Backend.api.open("{:url('lists/one/xubao')}?ids=" + res.renew.id, '续保', {area: ['100%', '100%']});
                        }, function(index) {
                            if(res.data.length==1){
                                layer.msg('查询成功')
                                var arr=res.data[0]
                                $("#c-car_factory_num").val(arr.standardname)//厂牌型号
                                $("#c-car_num").val(arr.car_num)
                                $("#c-car_vin").val(arr.car_vin)
                                $("#c-car_engine").val(arr.car_engine)
                                $("#c-car_factory_num").val(arr.car_factory_num)
                                $("#c-learned_name").val(arr.learned_name)
                                $("#c-learned_num").val(arr.learned_num)
                                $("#c-learned_phone").val(arr.learned_phone)
                                $("#c-car_owner").val(arr.learned_name)
                                $("#c-car_card").val(arr.learned_num)
                                $("#c-car_register").val(arr.car_register)
                                $("#c-plan_strattime").val(arr.plan_strattime)
                                gettimee(arr.plan_strattime)
                                vs()
                            }else{
                                var html=''
                                for(var i=0;i<res.data.length;i++){
                                    var tonnage = res.data[i].tonnage *1000;
                                    html+=` <tr>
            			                <td>`+res.data[i].learned_name+`</td>
            			                <td>`+res.data[i].learned_phone+`</td>
            			                <td>`+res.data[i].car_address+`</td>
            			                <td>`+res.data[i].learned_num+`</td>
            			                <td>`+res.data[i].car_num+`</td>
    			                        <td>`+res.data[i].car_vin+`</td>
                                        <td>`+res.data[i].car_engine+`</td>
                                        <td>`+res.data[i].car_factory_num+`</td>
                                        <td>`+res.data[i].car_register+`</td>
                                        <td>`+res.data[i].plan_strattime+`</td>
                                        <td><button type="button" class="layui-btn layui-btn-normal layui-btn-radius qxuanze" data-index=`+i+`>选择</button></td>
                                        </tr>`
                                }
                                $("#quansou_xuanze").html(html)
                                $("#myModal_quan").modal();
                                $('body').on('click', '.qxuanze', function (e) {
                                    var index=$(this).data("index")
                                    var arr=res.data[index]
                                    $("#c-car_factory_num").val(arr.standardname)//厂牌型号
                                    $("#c-car_num").val(arr.car_num)
                                    $("#c-car_vin").val(arr.car_vin)
                                    $("#c-car_engine").val(arr.car_engine)
                                    $("#c-car_factory_num").val(arr.car_factory_num)
                                    $("#c-learned_name").val(arr.learned_name)
                                    $("#c-learned_num").val(arr.learned_num)
                                    $("#c-learned_phone").val(arr.learned_phone)
                                    $("#c-car_owner").val(arr.learned_name)
                                    $("#c-car_card").val(arr.learned_num)
                                    $("#c-learned_address").val(arr.car_address)
                                    $("#c-car_register").val(arr.car_register)
                                    $("#c-plan_strattime").val(arr.plan_strattime)
                                    gettimee(arr.plan_strattime)
                                    $('#myModal_quan').modal('hide');
                                    vs()
                                });
                            }
                            layer.close(index);
                        })
                    }else{
                        if(res.data.length==1){
                            layer.msg('查询成功')
                            var arr=res.data[0]
                            $("#c-car_factory_num").val(arr.standardname)//厂牌型号
                            $("#c-car_num").val(arr.car_num)
                            $("#c-car_vin").val(arr.car_vin)
                            $("#c-car_engine").val(arr.car_engine)
                            $("#c-car_factory_num").val(arr.car_factory_num)
                            $("#c-learned_name").val(arr.learned_name)
                            $("#c-learned_num").val(arr.learned_num)
                            $("#c-learned_phone").val(arr.learned_phone)
                            $("#c-car_owner").val(arr.learned_name)
                            $("#c-car_card").val(arr.learned_num)
                            $("#c-car_register").val(arr.car_register)
                            $("#c-plan_strattime").val(arr.plan_strattime)
                            gettimee(arr.plan_strattime)
                            vs()
                        }else{
                            var html=''
                            for(var i=0;i<res.data.length;i++){
                                var tonnage = res.data[i].tonnage *1000;
                                html+=` <tr>
            			                <td>`+res.data[i].learned_name+`</td>
            			                <td>`+res.data[i].learned_phone+`</td>
            			                <td>`+res.data[i].car_address+`</td>
            			                <td>`+res.data[i].learned_num+`</td>
            			                <td>`+res.data[i].car_num+`</td>
    			                        <td>`+res.data[i].car_vin+`</td>
                                        <td>`+res.data[i].car_engine+`</td>
                                        <td>`+res.data[i].car_factory_num+`</td>
                                        <td>`+res.data[i].car_register+`</td>
                                        <td>`+res.data[i].plan_strattime+`</td>
                                        <td><button type="button" class="layui-btn layui-btn-normal layui-btn-radius qxuanze" data-index=`+i+`>选择</button></td>
                                        </tr>`
                            }
                            $("#quansou_xuanze").html(html)
                            $("#myModal_quan").modal();
                            $('body').on('click', '.qxuanze', function (e) {
                                var index=$(this).data("index")
                                var arr=res.data[index]
                                $("#c-car_factory_num").val(arr.standardname)//厂牌型号
                                $("#c-car_num").val(arr.car_num)
                                $("#c-car_vin").val(arr.car_vin)
                                $("#c-car_engine").val(arr.car_engine)
                                $("#c-car_factory_num").val(arr.car_factory_num)
                                $("#c-learned_name").val(arr.learned_name)
                                $("#c-learned_num").val(arr.learned_num)
                                $("#c-learned_phone").val(arr.learned_phone)
                                $("#c-car_owner").val(arr.learned_name)
                                $("#c-car_card").val(arr.learned_num)
                                $("#c-learned_address").val(arr.car_address)
                                $("#c-car_register").val(arr.car_register)
                                $("#c-plan_strattime").val(arr.plan_strattime)
                                gettimee(arr.plan_strattime)
                                $('#myModal_quan').modal('hide');
                                vs()
                            });
                        }
                    }
                }else{
                    layer.alert(res.message)
                }
            }
        })

    })

    function gettimee(date){
        $.ajax({
            type: 'post',
            url: "/api/order/s_time", //发送路径
            data: {
                time: date
            }, //发送的数据
            //                    dataType: 'json',
            async: false, //是否异步
            success: function(data) {
                $("#c-plan_endtime").val(data.data)
            }
        })
    }

    $('#c-car_reall').change(function (){
        huobiaofei()
    })

</script>
<!--图片上传开始-->

<script>
    var BASE_URL = '/assets/js/webuploader/webuploader';
    function upImage(id) {
        console.log(3333)
        $('#cardtype').val(id);
        // var myImage = ue.getDialog("insertimage");
        // myImage.open();
        $('#uploadBox0').show(500);
    }
    // 关闭上传图片弹窗
    function closee(){
        $("#uploadBox0").hide(500)
    }
</script>
<!--图片上传结束-->